Use smartctl to query and test drive health from the shell and catch problems before data loss. 11.06.2026 | reading time: 3 min A tiny command that reveals a disk's S.M.A.R.T. status can save hours of recovery work; `smartctl` is that command for Linux, used to query drive health, run diagnostics and trigger self-tests on ATA, SATA and many NVMe devices. Quick health check example Run a full readout and inspect the top lines to see whether the drive reports problems: ```bash sudo smartctl -a /dev/sda === START OF INFORMATION SECTION === Model Family: Generic Device Model: ExampleSSD SMART overall-health self-assessment test result: PASSED === START OF READ SMART DATA SECTION === ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail Always - 0 ``` How to read the numbers Look for the overall-health line first; a "PASSED" is good but not absolute — then check attributes like Reallocated_Sector_Ct, Current_Pending_Sector and Offline_Uncorrectable as non-zero values often indicate a mounting problem; also examine the raw self-test log with `-l selftest` to see recent short or long test failures and the timestamped context. Run tests and automation tips Start an on-demand short or long self-test with `-t short` or `-t long` and query its progress with `-c` in a loop; enable device monitoring and scheduled checks by running the `smartd` daemon, or wrap `smartctl -a` in a cron job or a systemd timer to capture trends and alert when thresholds change; remember that some NVMe drives need explicit device type hints or `-x` for extended info, and that SMART attributes are vendor-specific so compare trends, not absolute numbers. Other useful utilities nearby When `smartctl` flags trouble, use `hdparm` to inspect low-level drive settings, `badblocks` to scan for surface errors, `nvme-cli` for NVMe-specific diagnostics and `lsblk` or `blkid` to confirm device names and partitions before running destructive tools. Next steps for daily ops Integrate `smartctl` checks into monitoring and backups, replace drives showing reallocated or pending sectors, and keep copies of SMART logs for trend analysis; learning to automate these checks will reduce surprises and operational stress. Join Bits & Bytes Academy First class LINUX exam preparation. storage utilities backup troubleshooting infrastructure