Hard drives and SSDs usually give warning signs before they fail completely: reallocated sectors, read errors, wear levels approaching their limit. SMART (Self-Monitoring, Analysis and Reporting Technology) records these inside the drive, and smartctl reads them. On a dedicated server, checking SMART is how you catch a dying disk while RAID can still save your data.
On a VPS, the virtual disk doesn’t expose SMART data. The provider monitors the physical hardware. This guide applies to dedicated servers and your own hardware.
Install smartmontools
sudo apt install smartmontools # Debian/Ubuntu
sudo dnf install smartmontools # RHEL family
List the drives:
sudo smartctl --scan
lsblk -d -o NAME,SIZE,MODEL,ROTA
ROTA=1 means a spinning hard disk, and 0 means SSD or NVMe. See lsblk.
Quick health verdict
sudo smartctl -H /dev/sda
# SMART overall-health self-assessment test result: PASSED
PASSED only means the drive hasn’t crossed the manufacturer’s failure thresholds. Many drives fail while still reporting PASSED, so look at the attributes too.
Full report
sudo smartctl -a /dev/sda # SATA/SAS
sudo smartctl -a /dev/nvme0 # NVMe
sudo smartctl -x /dev/sda # extended (more logs)
Drives behind hardware RAID controllers need a device type: -d megaraid,0, -d cciss,0 and so on. Check your controller’s documentation.
SATA/SAS attributes that matter
| ID | Attribute | Worry when |
|---|---|---|
| 5 | Reallocated_Sector_Ct | Above 0 and growing |
| 187 | Reported_Uncorrect | Above 0 |
| 188 | Command_Timeout | Climbing |
| 197 | Current_Pending_Sector | Above 0 (sectors waiting to be remapped) |
| 198 | Offline_Uncorrectable | Above 0 |
| 199 | UDMA_CRC_Error_Count | Climbing (often a cable or backplane issue, not the disk) |
| 9 | Power_On_Hours | Context: age of the drive |
| 194 | Temperature_Celsius | Consistently above ~50–55 °C |
Look at the RAW_VALUE column for counts. The normalised VALUE/WORST/THRESH columns are vendor-scaled.
For SSDs, also check wear indicators such as Wear_Leveling_Count, Media_Wearout_Indicator or Percent_Lifetime_Remain. Names vary by vendor.
NVMe health
sudo smartctl -a /dev/nvme0
Key lines:
Critical Warning: 0x00
Temperature: 41 Celsius
Available Spare: 100%
Percentage Used: 7%
Media and Data Integrity Errors: 0
Unsafe Shutdowns: 12
- Critical Warning should be
0x00. - Percentage Used is the wear estimate. 100% means the rated endurance has been used, though drives often keep working beyond it.
- Available Spare falling towards its threshold, or Media Errors above 0, mean it’s time to plan a replacement.
nvme smart-log /dev/nvme0 (from nvme-cli) shows the same data.
Run self-tests
sudo smartctl -t short /dev/sda # ~2 minutes
sudo smartctl -t long /dev/sda # hours on large HDDs; runs in the background
sudo smartctl -l selftest /dev/sda # results
A failed self-test, with “read failure” and an LBA, is a strong signal to replace the drive.
Continuous monitoring with smartd
smartd watches drives in the background and alerts you. Edit /etc/smartd.conf (Debian/Ubuntu) or /etc/smartmontools/smartd.conf (RHEL):
DEVICESCAN -a -o on -S on -n standby,q -s (S/../.././02|L/../../6/03) -W 4,45,55 -m [email protected]
-a— monitor all attributes.-s (S/../.././02|L/../../6/03)— a short test daily at 02:00 and a long test on Saturdays at 03:00.-W 4,45,55— report temperature changes of 4 °C, and warn at 45 °C and 55 °C.-m— the email address. It needs a working local mail setup (Postfix or msmtp).
sudo systemctl enable --now smartd # 'smartmontools' service on some Debian versions
Monitoring systems like Netdata and Prometheus’ smartctl exporter can graph SMART values and alert too. See Netdata.
When a drive shows problems
- Check that backups are current. Do it now, before anything else. See the 3-2-1 rule.
- Check RAID status:
cat /proc/mdstatorzpool status. See mdadm and ZFS. - Note the drive’s serial number (
smartctl -i /dev/sda) so the right physical disk is replaced. - On a dedicated server, open a support ticket with the SMART output and serial number to request a drive replacement.
- After the swap, rebuild the RAID and verify it.
Also check kernel logs for I/O errors. See dmesg.
Quick reference
| Task | Command |
|---|---|
| List drives | smartctl --scan |
| Health verdict | smartctl -H /dev/sda |
| Full report | smartctl -a /dev/sda |
| NVMe | smartctl -a /dev/nvme0 |
| Short / long test | smartctl -t short|long /dev/sda |
| Test results | smartctl -l selftest /dev/sda |
| Serial number | smartctl -i /dev/sda |
| Monitoring daemon | smartd |
Related: iostat and Linux disk performance.