SMART disk diagnostics on a server: how to read it and what to do
SMART data is read with smartctl from the smartmontools package: smartctl -a /dev/sda for SATA and SAS, smartctl -a /dev/nvme0 for NVMe. You replace a drive based on specific counters, not on the "PASSED" verdict: reallocated sectors, pending sectors, interface CRC errors and the remaining write endurance.
- The line
SMART overall-health self-assessment test result: PASSEDonly means no attribute has crossed the vendor threshold. A drive with a hundred reallocated sectors prints it too. - Three things are dangerous: growing
Reallocated_Sector_Ct, a non-zeroCurrent_Pending_Sector, and any value inOffline_Uncorrectable. - NVMe has its own fields:
percentage_used,media_errors,critical_warning,available_spare. - The
smartddaemon runs tests on a schedule and mails you as soon as a counter moves.
Installation and the first read
The package name is identical in both families; add nvme-cli for NVMe.
# Debian/Ubuntu
apt-get install -y smartmontools nvme-cli
# RHEL, AlmaLinux, Rocky
dnf install -y smartmontools nvme-cli
# list the devices smartctl can see
smartctl --scan
# full report for a SATA/SAS drive
smartctl -a /dev/sda
# attributes only, no header
smartctl -A /dev/sda
# NVMe: health log
smartctl -a /dev/nvme0
nvme smart-log /dev/nvme0
If the disks sit behind a RAID controller, add the device type to the command, for example -d megaraid,8. How to tell which array implementation you have is covered in hardware RAID or mdadm.
Which attributes matter
| Attribute | Meaning | Healthy | Action |
|---|---|---|---|
| 5 Reallocated_Sector_Ct | sectors remapped from the spare area | 0 and stable | growth within a week means plan a replacement |
| 197 Current_Pending_Sector | sectors that fail to read but are not remapped yet | 0 | any non-zero value means run a long test |
| 198 Offline_Uncorrectable | sectors not recovered during the background scan | 0 | replace the drive |
| 199 UDMA_CRC_Error_Count | transfer errors on the bus | 0 and stable | cable or backplane slot, not the disk |
| 187 Reported_Uncorrect | errors the drive reported to the host | 0 | replace the drive |
NVMe reads differently
NVMe has no classic attribute table; it exposes a health log with fixed fields instead. Four of them matter: critical_warning (anything other than zero is an incident), percentage_used (write endurance consumed in percent, where 100 means the rated TBW is exhausted), media_errors (uncorrectable media errors) and available_spare together with available_spare_threshold.
Self-tests
The short test checks the electronics and part of the surface in 1–2 minutes; the long one reads the whole surface and runs for hours. The drive executes both in the background while the server keeps working.
# short test
smartctl -t short /dev/sda
# long test
smartctl -t long /dev/sda
# abort the running test
smartctl -X /dev/sda
# results of the latest tests
smartctl -l selftest /dev/sda
# drive error log
smartctl -l error /dev/sda 2>&1 | head -n 40
Automatic monitoring with smartd
# config: /etc/smartd.conf (RHEL) or /etc/smartmontools/smartd.conf (Debian/Ubuntu)
# one line covering every detected drive:
# DEVICESCAN -a -o on -S on -n standby,q -s (S/../.././02|L/../../6/03) -W 4,45,55 -m root@localhost
systemctl enable --now smartd # Debian/Ubuntu
systemctl enable --now smartd # RHEL, AlmaLinux, Rocky
systemctl status smartd
The schedule above means a short test every night at 02:00 and a long one on Saturdays at 03:00. Mail arrives only if the server has a working mail transport; on VDS outgoing SMTP is closed by default and opened on request, so shipping SMART metrics into a monitoring system is more reliable, as described in the guide on server hardware monitoring.
A common mistake is calling a drive healthy because smartctl -H returned PASSED. That verdict fires only on a factory threshold crossing, while a drive with hundreds of reallocated sectors has not reached the threshold yet and keeps returning read errors. Inside a RAID that looks like random I/O stalls with no array degradation message at all. Check it differently: capture smartctl -A once a day and compare the RAW_VALUE of attributes 5, 187, 197 and 198 with the previous snapshot. Any increase is a reason to pull the drive and request a disk replacement in the array before it fails outright.
When to replace a drive
- Immediately: non-zero
Offline_UncorrectableorReported_Uncorrect, a non-zero NVMecritical_warning, read failures in the self-test log. - Within days: a growing
Reallocated_Sector_Ct, or aCurrent_Pending_Sectorthat does not clear after a long test. - Do not replace: growth in
UDMA_CRC_Error_Countalone points at the cable or the cage slot, and a new disk changes nothing.
On ZevsHost dedicated servers the on-duty data centre shift swaps a drive on request: you collect the smartctl -a output and the drive serial number, and the site engineers take it from there.
Key takeaways
- Use
smartctl -afor SATA and SAS,smartctl -a /dev/nvme0ornvme smart-logfor NVMe. - Decide on the
RAW_VALUEof attributes 5, 187, 197, 198 and on their trend, not on the PASSED line. - For NVMe watch
percentage_used,media_errors,available_spareandcritical_warning.