S.M.A.R.T. (S.M.A.R.T.)
S.M.A.R.T. is a health report built into nearly every hard drive and SSD. The drive keeps track of its own temperature, errors, wear, and how long it has been running. Reading that report can warn you a drive is about to fail, giving you time to copy your data off. It will not catch every failure, but ignoring a bad report is asking for trouble.
S.M.A.R.T. is implemented in drive firmware and read through ATA, SCSI, or NVMe commands. On Linux the standard tool is smartctl from smartmontools, with smartd for background monitoring.
SATA/ATA attributes to watch:
- 5 Reallocated_Sector_Ct: bad sectors remapped. Any steady increase is a warning.
- 197 Current_Pending_Sector: sectors waiting to be remapped
- 198 Offline_Uncorrectable: sectors that could not be read
- 199 UDMA_CRC_Error_Count: link errors, usually a bad cable
- 9 Power_On_Hours, 194 Temperature_Celsius
- SSD wear: vendor-specific (Wear_Leveling_Count, Media_Wearout_Indicator, Percent_Lifetime_Remain)
NVMe health log: critical_warning, percentage_used, available_spare, media_errors, temperature.
Self-tests: short (about 2 minutes), long (hours on large HDDs), conveyance.
Overall assessment reports PASSED or FAILED, but PASSED is a low bar. Trends in the raw values tell you more.
Limits: VMs show virtual disks with no real SMART data, and USB enclosures may need -d sat to pass it through.
Source: smartmontools project
Reading drive health
$ sudo apt install smartmontools
# Overall health
$ sudo smartctl -H /dev/sda
SMART overall-health self-assessment test result: PASSED
# Key attributes
$ sudo smartctl -A /dev/sda | grep -E "Reallocated|Pending|Uncorrect|CRC"
5 Reallocated_Sector_Ct ... 0
197 Current_Pending_Sector ... 0
# NVMe
$ sudo smartctl -a /dev/nvme0n1 | grep -E "Percentage Used|Media and Data"
# Run a long test, check results later
$ sudo smartctl -t long /dev/sda
$ sudo smartctl -l selftest /dev/sda Turn on smartd email alerts on any machine that stores data you care about, and NAS systems like TrueNAS do this for you. A single reallocated sector is not panic, but a rising count means replace the disk soon. CRC errors mean reseat or replace the cable first. SMART is an early warning, not a guarantee; plenty of drives die with a clean report, which is why backups come first.