Monitoring disk health in Linux reduces the risk of sudden data loss by revealing failing HDDs and SSDs before they stop responding. Early detection allows storage to be replaced during maintenance windows instead of during outages, keeping services and personal files available.

Disk firmware exposes internal health metrics through S.M.A.R.T. (Self-Monitoring, Analysis, and Reporting Technology). On Linux these metrics are typically accessed with the smartctl utility from the smartmontools package, which can read attributes, run built-in self-tests, and show overall health summaries for devices such as /dev/sda or /dev/nvme0n1.

S.M.A.R.T. cannot detect every failure mode and does not substitute for regular backups, filesystem checks, or RAID monitoring. Some controllers or virtual disks may not expose full data, and intensive self-tests can temporarily impact performance on busy systems. The steps below focus on a short, non-destructive check on Ubuntu or other Debian-based distributions with root privileges available through sudo.

Steps to check hard drive health status in Linux:

  1. Open a terminal session on the Linux system.
  2. Refresh package metadata before installing disk utilities.
    $ sudo apt update
    
    WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
    
    Hit:1 http://ports.ubuntu.com/ubuntu-ports noble InRelease
    Hit:2 http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease
    Hit:3 http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease
    Hit:4 http://ports.ubuntu.com/ubuntu-ports noble-security InRelease
    Reading package lists...
    Building dependency tree...
    Reading state information...
    5 packages can be upgraded. Run 'apt list --upgradable' to see them.
  3. Install the smartmontools package from the distribution repository.
    $ sudo apt install --assume-yes smartmontools
    
    WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
    
    Reading package lists...
    Building dependency tree...
    Reading state information...
    smartmontools is already the newest version (7.4-2build1).
    0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.

    On Debian and Ubuntu, smartmontools provides the smartctl command; other distributions use package managers such as dnf, zypper, or pacman to install the same package.

  4. List block devices to identify the target disk name.
    $ lsblk -d -o NAME,TYPE,SIZE | grep -E 'disk|nvme'
    nbd0  disk     0B
    nbd1  disk     0B
    nbd2  disk     0B
    nbd3  disk     0B
    nbd4  disk     0B
    nbd5  disk     0B
    nbd6  disk     0B
    nbd7  disk     0B
    vda   disk   1.8T
    vdb   disk 606.5M
    nbd8  disk     0B
    nbd9  disk     0B
    nbd10 disk     0B
    nbd11 disk     0B
    nbd12 disk     0B
    nbd13 disk     0B
    nbd14 disk     0B
    nbd15 disk     0B

    This output shows classic SATA disks such as /dev/sda as well as any NVMe disks when present; the appropriate device name is required for later commands.

  5. Query basic information on the selected disk to confirm that S.M.A.R.T. support is enabled.
    $ sudo smartctl -i /dev/vdb
    smartctl 7.4 2023-08-01 r5530 [aarch64-linux-6.12.54-linuxkit] (local build)
    Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org
    
    /dev/vdb: Unable to detect device type
    Please specify device type with the -d option.
    
    Use smartctl -h to get a usage summary

    Proceed only when the output shows that S.M.A.R.T. support is available and enabled; some virtual disks or USB adapters may not expose these capabilities.

  6. Start a short S.M.A.R.T. self-test on the selected disk.
    $ sudo smartctl -t short /dev/vdb
    smartctl 7.4 2023-08-01 r5530 [aarch64-linux-6.12.54-linuxkit] (local build)
    Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org
    
    /dev/vdb: Unable to detect device type
    Please specify device type with the -d option.
    
    Use smartctl -h to get a usage summary

    Short self-tests are non-destructive but can still impact performance, so running tests on busy production disks may cause higher latency or temporary slowdowns.

  7. Display the overall S.M.A.R.T. health status after the short test completes.
    $ sudo smartctl -H /dev/vdb
    smartctl 7.4 2023-08-01 r5530 [aarch64-linux-6.12.54-linuxkit] (local build)
    Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org
    
    /dev/vdb: Unable to detect device type
    Please specify device type with the -d option.
    
    Use smartctl -h to get a usage summary

    A result such as PASSED or OK indicates that the disk firmware does not currently consider the device to be failing, although backups remain essential.

  8. Inspect detailed S.M.A.R.T. attributes to spot reallocated sectors or read errors.
    $ sudo smartctl -a /dev/vdb
    smartctl 7.4 2023-08-01 r5530 [aarch64-linux-6.12.54-linuxkit] (local build)
    Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org
    
    /dev/vdb: Unable to detect device type
    Please specify device type with the -d option.
    
    Use smartctl -h to get a usage summary

    Growing counts for attributes such as Reallocated_Sector_Ct or Current_Pending_Sector often indicate impending failure even when the overall health status still shows PASSED.

  9. Review the S.M.A.R.T. self-test log to confirm that recent tests completed without error.
    $ sudo smartctl -l selftest /dev/vdb
    smartctl 7.4 2023-08-01 r5530 [aarch64-linux-6.12.54-linuxkit] (local build)
    Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org
    
    /dev/vdb: Unable to detect device type
    Please specify device type with the -d option.
    
    Use smartctl -h to get a usage summary

    A status of Completed without error for the most recent entry verifies that the short self-test finished successfully.

  10. Retry with an explicit device type when working with passthrough or virtual disks.
    $ sudo smartctl -a -d scsi -T permissive /dev/vdb
    smartctl 7.4 2023-08-01 r5530 [aarch64-linux-6.12.54-linuxkit] (local build)
    Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org
    
    Standard Inquiry (36 bytes) failed [Inappropriate ioctl for device]
    Retrying with a 64 byte Standard Inquiry
    Standard Inquiry (64 bytes) failed [Inappropriate ioctl for device]
    
    === START OF READ SMART DATA SECTION ===
    Request Sense failed, [Inappropriate ioctl for device]
    Read defect list: asked for grown list but didn't get it
    Error Counter logging not supported
    
    Device does not support Self Test logging

    If the disk still does not report S.M.A.R.T. data, it may be a virtual device or controller that does not expose health metrics; check the host or use physical hardware for SMART checks.