How to Check Disk Health with SMART
Learn to use smartctl to read SMART attributes, run drive self-tests, and identify early warning signs of HDD and SSD failure before data loss occurs.
Before you start
- ▸sudo or root access on the target system
- ▸A SATA, SAS, or NVMe drive (USB drives have limited SMART support)
- ▸Basic comfort running commands in a terminal
SMART (Self-Monitoring, Analysis and Reporting Technology) is firmware built into nearly every modern hard drive and SSD. It records internal health metrics — temperature, read error rates, reallocated sectors, and more — that let you catch a failing drive before it takes your data with it. The primary tool for reading this data on Linux is smartctl, part of the smartmontools package. This guide walks through installation, reading attributes, running self-tests, and recognising the signs of a drive in trouble.
Installing smartmontools
Debian / Ubuntu
sudo apt update && sudo apt install smartmontools
Fedora / RHEL / Rocky Linux
sudo dnf install smartmontools
Arch Linux
sudo pacman -S smartmontools
Once installed, confirm the version and that the smartd daemon is available:
smartctl --version
Identifying Your Drives
Before querying SMART data you need the correct device path. Use either of these:
lsblk -d -o NAME,TYPE,SIZE,TRAN
# or
ls /dev/disk/by-id/
Typical paths are /dev/sda for SATA/SAS, /dev/nvme0 (or /dev/nvme0n1) for NVMe. Use the bare device node, not a partition (/dev/sda not /dev/sda1).
Checking SMART Support and Overall Health
First, verify the drive supports SMART and see its summary verdict:
sudo smartctl -i /dev/sda
Look for SMART support is: Enabled. If it says disabled, enable it:
sudo smartctl -s on /dev/sda
The single most important one-liner is the overall health check:
sudo smartctl -H /dev/sda
A healthy drive replies SMART overall-health self-assessment test result: PASSED. A FAILED! result means the drive's own firmware predicts imminent failure — back up immediately and replace the drive.
For NVMe drives the command is the same; smartctl handles the different protocol transparently:
sudo smartctl -H /dev/nvme0
Reading SMART Attributes
The full attribute table is the real diagnostic goldmine:
sudo smartctl -A /dev/sda
Each row has an ID, name, current value, worst value ever recorded, threshold, and raw value. The rule is simple: if VALUE falls at or below THRESHOLD the drive has failed that attribute. Raw values give you the real-world numbers. Key attributes to watch:
| ID | Name | What it means |
|---|---|---|
| 5 | Reallocated Sectors Count | Bad sectors remapped to spare area. Any non-zero raw value on a consumer drive is a warning. Rising counts are serious. |
| 187 | Reported Uncorrectable Errors | Errors ECC could not fix. Non-zero = bad news. |
| 188 | Command Timeout | Commands that timed out. Non-zero warrants investigation. |
| 197 | Current Pending Sectors | Sectors awaiting reallocation. Unstable reads. Even 1 is concerning. |
| 198 | Uncorrectable Sector Count | Sectors that couldn't be read or reallocated. Non-zero is critical. |
| 190/194 | Temperature | Raw value is degrees Celsius. Sustained >55 °C for HDDs shortens life. |
| 9 | Power-On Hours | Total runtime. Context for other wear figures. |
| 177/202 | SSD Wear Leveling / Media Wearout | SSD-specific: percentage of write endurance consumed. |
For a complete report combining health, attributes, error log, and test history in one shot:
sudo smartctl -a /dev/sda
Running SMART Self-Tests
SMART has three built-in test types. They run in the background with minimal performance impact; the drive stays mounted and usable during the test.
- Short — Tests the electrical and mechanical parts plus a small read sample. Takes 1–5 minutes.
- Long (Extended) — Full surface scan. Takes hours on large HDDs (plan for 1–2 hours per TB).
- Conveyance — Checks for shipping damage. SATA HDDs only; optional.
Start a short test
sudo smartctl -t short /dev/sda
Start a long test
sudo smartctl -t long /dev/sda
smartctl will estimate when the test completes. Check progress mid-test:
sudo smartctl -l selftest /dev/sda
The output lists recent test results. A healthy result shows Completed without error. Watch for read failure or Interrupted, which indicate a real problem. The log stores the last 21 results.
Reading the Error Log
Even if attributes look clean, the error log can reveal intermittent problems:
sudo smartctl -l error /dev/sda
A few legacy CRC errors (attribute 199) on an old cable are common and less alarming than read/write errors tied to specific LBA addresses, which point to physical media damage.
Automating Health Monitoring with smartd
Rather than checking manually, let smartd watch your drives and email you on trouble. The main config file is /etc/smartd.conf. The simplest useful line to add for each drive:
# /etc/smartd.conf
/dev/sda -a -o on -S on -s (S/../.././02|L/../../6/03) -m root -M exec /usr/share/smartmontools/smartd-runner
Flags explained: -a monitors all attributes, -o on enables automatic offline testing, -S on enables attribute autosave, -s schedules a short test daily at 02:00 and a long test every Saturday at 03:00, -m root sends warnings to root's mailbox.
Enable and start the daemon:
sudo systemctl enable --now smartd
Verify it's running:
sudo systemctl status smartd
Spotting a Dying Drive — Summary Checklist
- Overall health check returns
FAILED - Reallocated Sectors (ID 5) raw value is non-zero and climbing
- Current Pending Sectors (ID 197) or Uncorrectable Sectors (ID 198) is non-zero
- Reported Uncorrectable Errors (ID 187) is non-zero
- Self-test log shows repeated
read failureat specific LBAs - Error log shows a pattern of read/write errors on specific sectors
- Spin retry count (ID 10) rising on a mechanical drive
A single data point in isolation can be misleading. A drive that shows one reallocated sector and nothing else may be stable for years, but monitor it. A drive with rising counts across multiple warning attributes is actively failing.
Troubleshooting
smartctl reports "Unable to detect device type"
Specify the device type explicitly. For drives behind a MegaRAID controller:
sudo smartctl -d megaraid,0 -a /dev/sda
Run sudo smartctl --scan to let smartctl auto-detect devices and their required type flags on your system.
NVMe drive shows no attributes
NVMe uses a different structure. Use -x (extended info) instead of -a:
sudo smartctl -x /dev/nvme0
Permission denied without sudo
smartctl needs raw device access, which requires root. Add your user to the disk group only if you fully understand the security implications — membership grants broad raw device access.
smartd fails to start
Check the journal for the specific error:
sudo journalctl -u smartd -n 50
A common cause is a syntax error in /etc/smartd.conf. Validate with sudo smartd -q onecheck before restarting the service.
Frequently asked questions
- Can I run SMART tests on a mounted drive without unmounting it?
- Yes. SMART self-tests run entirely within the drive's own firmware and do not require the filesystem to be unmounted. The drive remains fully accessible during the test with minimal performance impact.
- My drive shows a few reallocated sectors but has passed all self-tests. Should I replace it?
- A small static count of reallocated sectors with no increase over time is not automatically a death sentence, but you should monitor it closely with smartd and maintain current backups. If the count is rising, replace the drive sooner rather than later.
- Does SMART work on SSDs and NVMe drives?
- Yes, but the relevant attributes differ. For SSDs watch the wear-leveling and media-wearout indicators (IDs 177, 202, or manufacturer-specific equivalents). For NVMe, use smartctl -x /dev/nvme0 to see the extended NVMe-specific health log.
- How reliable is SMART at predicting drive failure?
- Large-scale studies (including Backblaze's published data) show SMART catches many but not all failures. Some drives fail suddenly with no SMART warnings, so SMART monitoring supplements but never replaces regular backups.
- My drives are behind a hardware RAID controller and smartctl can't see them. What do I do?
- Hardware RAID controllers often intercept raw device access. Run smartctl --scan to detect the correct device type flag, then pass it explicitly — for example, -d megaraid,0 for MegaRAID or -d cciss,0 for HP Smart Array controllers.
Related guides
Back Up Linux with Borg or restic
Set up encrypted, deduplicated backups with BorgBackup or restic: local and remote repos, retention pruning, restoring files, and systemd timer scheduling.
Debug systemd Units that Won't Start
Learn a repeatable workflow to debug systemd services that won't start: status output, journalctl, systemd-analyze verify, and safe override.conf patches.
Linux Server Disaster Recovery Checklist
A practical Linux server disaster recovery checklist: what to back up, RTO/RPO planning, immutable off-site copies, automated restore drills, and verification.
How to Fix a Broken GRUB Bootloader
Fix a broken GRUB bootloader by booting from live media, chrooting into your installed system, reinstalling GRUB, and regenerating grub.cfg — covers BIOS/MBR and UEFI/GPT.