sudo dnf install smartmontools # or apt-get install smartmontools
sudo smartctl -i /dev/sda # identity: model, serial, firmware, SMART support
sudo smartctl -H /dev/sda # overall health verdict
sudo smartctl -a /dev/sda # everything: attributes, error log, self-test log
sudo smartctl -x /dev/sda # extended (more log pages)
The verdict looks like:
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
"PASSED" is not a guarantee. A drive only reports FAILED when a threshold is crossed, which often happens late. Read the attributes:
Reallocated_Sector_Ct,Current_Pending_Sector,Offline_Uncorrectable: any non-zero and rising value is a warning to replace the drive.UDMA_CRC_Error_Count: cable or connector problems, not the platters.- For NVMe (
smartctl -a /dev/nvme0):Percentage Used,Available Spare, andMedia and Data Integrity Errors.
Self-tests¶
sudo smartctl -t short /dev/sda # about 2 minutes
sudo smartctl -t long /dev/sda # hours; runs in the background
sudo smartctl -l selftest /dev/sda # results
Monitoring¶
smartd (same package) checks drives periodically and emails or logs problems. Enable it with sudo systemctl enable --now smartd (service name smartmontools on Debian). Behind hardware RAID controllers, tell smartctl how to reach the physical disks (-d megaraid,N, -d cciss,N). See also badblocks and hdparm.