smartctl -a /dev/sda prints forty or fifty numbers, and almost none of them tell you whether the disk is about to die. The ones that do are a short list: Reallocated_Sector_Ct (ID 5), Reported_Uncorrect (187), Command_Timeout (188), Current_Pending_Sector (197) and Offline_Uncorrectable (198) on spinning disks; the wear indicator on SATA SSDs; Percentage_Used and Available_Spare on NVMe. Spin-up time, seek error rate, temperature and the rest are context, not prediction. This guide covers reading those specific counters on SATA, SAS and NVMe — including disks hidden behind a USB bridge or a hardware RAID controller — running the self-tests that catch what the counters miss, and configuring smartd to email you when something moves.
What you’ll accomplish
- Read SMART data from every disk on a host, including drives that a RAID controller or USB enclosure normally hides.
- Tell the handful of attributes that correlate with failure apart from the vendor-specific noise around them.
- Schedule short and long self-tests, and read the self-test log — the test result is often better evidence than any attribute.
- Configure
smartdso a degrading disk emails the on-call address instead of waiting for someone to runsmartctlby hand. - Know what SMART cannot tell you, so the monitoring supplements backups and redundancy rather than standing in for them.
Prerequisites
- smartmontools 7.0 or newer. NVMe support matured through the 7.x series; older builds give partial or wrong NVMe output. Debian 12 ships 7.3, Ubuntu 24.04 ships 7.4, RHEL 9 ships 7.2. Install with
apt install smartmontoolsordnf install smartmontools. - Root or
sudo. SMART commands go straight to the device and need raw access. - Direct access to the physical disk. SATA and SAS drives on an HBA in IT mode, and NVMe devices, work with no extra flags. USB enclosures usually need
-d sat. Drives behind a hardware RAID controller are not block devices at all and need-d megaraid,N,-d cciss,Nor-d areca,N. - Virtual disks have no SMART. A
virtiodisk, an attached cloud volume, or a device-mapper target passes nothing through. Run this on the hypervisor or the bare-metal host. - A working mail path if you want
smartdto notify you — a local MTA, or a-M execscript that calls whatever you already use.
How it works
A drive keeps its own counters in firmware. Every remapped sector, every read that needed retries, every hour of power-on time increments a value that the drive stores and reports on request. Nothing in the operating system computes these numbers; the OS only asks for them and formats the answer.
Getting the question to the drive is where most of the trouble lives. ATA and SAS drives answer a SMART command sent over their native protocol. NVMe devices answer a completely different thing — log page 0x02, with a fixed set of fields rather than a vendor-defined attribute table. A USB enclosure sits a bridge chip in the middle that may or may not translate SMART commands, which is what -d sat (SCSI/ATA Translation) is for. A hardware RAID controller presents one virtual disk and keeps the members to itself, so smartctl has to address them through the controller with -d megaraid,N.
Once you get an answer, the format matters. Each ATA attribute has a normalised VALUE (usually starting at 100 or 200 and counting down), a WORST ever seen, a THRESH below which the drive declares itself failing, and a RAW_VALUE that holds the real count. The overall verdict from smartctl -H is nothing more than “is any pre-fail attribute below its threshold”, and it says PASSED on plenty of drives that are visibly dying, because vendors set those thresholds so they are almost never crossed. Read the raw values yourself.
The honest part: large-scale studies of drive populations — Google’s 2007 paper on failure trends, and the fleet statistics Backblaze has published quarterly for over a decade — converge on the same conclusion. Only a few attributes have any predictive power, and a large fraction of failed drives showed nothing unusual beforehand. SMART is a cheap early warning for one failure mode, media degradation, and it is silent about controller failure, firmware bugs and sudden electrical death.
Step-by-step
1. Enumerate what smartctl can see. The scan tells you which devices it will address and with what type:
sudo smartctl --scan
/dev/sda -d scsi # /dev/sda, SCSI device
/dev/sdb -d scsi # /dev/sdb, SCSI device
/dev/nvme0 -d nvme # /dev/nvme0, NVMe device
If a disk you know is installed does not appear here, it is behind a controller — jump to step 5.
2. Confirm SMART is on. Some drives ship with it disabled, and a disabled drive silently reports nothing:
sudo smartctl -i /dev/sda
Device Model: ST8000NM000A-2KE101
Serial Number: WKD0P4ZQ
Rotation Rate: 7200 rpm
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
If the last line says Disabled, turn it on. The setting persists across power cycles:
sudo smartctl -s on /dev/sda
SMART Enabled.
3. Read the attributes. -A prints only the attribute table, which is what you want when you know which rows to look at:
sudo smartctl -A /dev/sda
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE WHEN_FAILED RAW_VALUE
5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail - 0
9 Power_On_Hours 0x0032 087 087 000 Old_age - 58412
187 Reported_Uncorrect 0x0032 100 100 000 Old_age - 0
188 Command_Timeout 0x0032 100 100 000 Old_age - 0
194 Temperature_Celsius 0x0022 036 045 000 Old_age - 36
197 Current_Pending_Sector 0x0012 100 100 000 Old_age - 8
198 Offline_Uncorrectable 0x0010 100 100 000 Old_age - 8
Read the RAW_VALUE column, not VALUE. This drive reports PASSED overall — every normalised value is far above its threshold — while carrying 8 pending and 8 uncorrectable sectors. That is a drive with real unreadable data on it.
For a SATA SSD, the row to find is the wear indicator, whose name depends on the vendor: Media_Wearout_Indicator (ID 233), Percent_Lifetime_Remain (202), SSD_Life_Left (231). It counts down from 100, and 100 minus the value is roughly the percentage of rated write endurance consumed.
4. Read an NVMe device. NVMe has no attribute table; it has a health log with named fields:
sudo smartctl -a /dev/nvme0
SMART/Health Information (NVMe Log 0x02)
Critical Warning: 0x00
Temperature: 41 Celsius
Available Spare: 100%
Available Spare Threshold: 10%
Percentage Used: 7%
Data Units Written: 118,204,442 [60.5 TB]
Media and Data Integrity Errors: 0
Error Information Log Entries: 0
Three fields carry the signal. Critical Warning is a bitmask, and anything non-zero needs investigating immediately. Available Spare falling toward Available Spare Threshold means the drive is running out of replacement blocks. Percentage Used is the manufacturer’s endurance estimate and can exceed 100% without the drive failing — it means you are past the rated write budget, not that the disk is dead.
5. Reach disks the OS is hiding. For a drive in a USB enclosure, the plain call fails with a hint:
sudo smartctl -a /dev/sdc
/dev/sdc: Unknown USB bridge [0x0bc2:0xab38 (0x100)]
Please specify device type with the -d option.
Add the translation layer explicitly, and if plain sat fails, try the 12-byte command variant:
sudo smartctl -a -d sat /dev/sdc
For a disk behind an LSI/Broadcom MegaRAID controller, address the controller node and the drive’s device ID. Device IDs come from storcli /c0 show or perccli:
sudo smartctl -a -d megaraid,8 /dev/sda
Device Model: ST8000NM000A-2KE101
SMART overall-health self-assessment test result: PASSED
The same pattern applies with -d cciss,N on HP Smart Array controllers and -d areca,N on Areca. The N in megaraid,N is the drive’s device ID, not the slot number, and the two often differ.
6. Run a short self-test. The short test takes one to two minutes and exercises the electronics plus a small read sample. It runs on the drive itself, in the background, while the filesystem stays mounted:
sudo smartctl -t short /dev/sda
Testing has begun.
Please wait 1 minutes for test to complete.
Test will complete after Tue Jul 29 14:22:11 2026
7. Run a long self-test. The long test reads every sector. On an 8 TB disk that is roughly twelve hours and it will slow foreground I/O, so ask the drive for its own estimate first:
sudo smartctl -c /dev/sda | grep -A2 'Extended self-test routine'
Extended self-test routine
recommended polling time: ( 706) minutes.
Then start it:
sudo smartctl -t long /dev/sda
If you need the drive back, sudo smartctl -X /dev/sda aborts the running test.
8. Read the self-test log. This is the highest-value output in the whole tool, because a long test that fails to read a sector is direct evidence, not a statistical hint:
sudo smartctl -l selftest /dev/sda
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Extended offline Completed: read failure 90% 58390 1953504368
# 2 Short offline Completed without error 00% 58388 -
Completed: read failure with an LBA means the drive could not read that sector. Combined with a non-zero Current_Pending_Sector, that is a replacement decision, not a monitoring decision.
9. Write the smartd configuration. The file is /etc/smartd.conf on Debian and Ubuntu, /etc/smartmontools/smartd.conf on RHEL-family systems. Comment out the default DEVICESCAN line and list devices explicitly, or keep DEVICESCAN with directives appended — you cannot have both:
sudo tee /etc/smartd.conf >/dev/null <<'EOF'
/dev/sda -a -o on -S on -n standby,q -s (S/../.././02|L/../../6/03) -W 4,45,55 -m ops@example.com
/dev/nvme0 -a -W 4,60,70 -m ops@example.com
EOF
The directives, in order: -a turns on the usual checks (health, attribute changes, error log, self-test log, plus tracking of 197 and 198); -o on and -S on enable offline data collection and attribute autosave; -n standby,q skips a check rather than spinning up an idle disk; -s schedules a short test daily at 02:00 and a long test Saturdays at 03:00; -W 4,45,55 warns on a 4-degree jump, at 45 C, and critically at 55 C; -m is the destination address.
10. Validate the configuration before restarting the daemon. A syntax error in smartd.conf stops the service from starting at all. Run one check pass in the foreground:
sudo smartd -q onecheck
Device: /dev/sda [SAT], opened
Device: /dev/sda [SAT], ST8000NM000A-2KE101, S/N:WKD0P4ZQ, 8.00 TB
Device: /dev/sda [SAT], is SMART capable. Adding to "monitor" list.
Device: /dev/nvme0, NVMe device, opened
Monitoring 1 ATA/SATA, 0 SCSI/SAS and 1 NVMe devices
11. Prove the mail path works. Add -M test temporarily to one device line, then restart. That directive sends a test message every time the daemon starts:
sudo systemctl restart smartd
On Debian and Ubuntu the unit is smartmontools.service with smartd.service as an alias, so either name works. Once the mail arrives, remove -M test and restart again — otherwise every reboot sends one and people learn to ignore them.
Validate it works
Confirm the daemon is running and watching the right devices:
systemctl is-active smartd && sudo journalctl -u smartd --since '10 min ago' | tail -5
active
smartd[1421]: Device: /dev/sda [SAT], is SMART capable. Adding to "monitor" list.
smartd[1421]: Device: /dev/nvme0, is SMART capable. Adding to "monitor" list.
smartd[1421]: Monitoring 1 ATA/SATA, 0 SCSI/SAS and 1 NVMe devices
Confirm the scheduled tests are actually running. After a week, the self-test log should show new entries with recent lifetime hours:
sudo smartctl -l selftest /dev/sda | head -6
Get a one-line health summary for every disk on the host. This is the command worth putting in a runbook:
sudo smartctl --scan | awk '{print $1}' | \
xargs -I{} sh -c 'echo "== {}"; smartctl -H -A {} | grep -E "overall-health|Reallocated_Sector_Ct|Current_Pending|Offline_Uncorr|Percentage Used|Available Spare"'
== /dev/sda
SMART overall-health self-assessment test result: PASSED
5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail - 0
197 Current_Pending_Sector 0x0012 100 100 000 Old_age - 8
198 Offline_Uncorrectable 0x0010 100 100 000 Old_age - 8
== /dev/nvme0
Available Spare: 100%
Percentage Used: 7%
Troubleshooting
Unknown USB bridgeorOperation not supported by device. Try-d sat, then-d sat,12(some bridges only accept the 12-byte ATA pass-through), then-d usbjmicronor-d usbprolificdepending on the chip inlsusboutput. Many cheap enclosures never pass SMART through at all, in which case the drive has to come out to be checked.smartctl -Hsays PASSED on a disk that is obviously failing. Expected behaviour, not a bug. The verdict only fires when a pre-fail attribute drops below the vendor threshold, and those thresholds are set so low they are rarely reached. Alert on raw values of 5, 197 and 198 changing, and on self-test failures. Never treatPASSEDas evidence of health.- smartd starts but no email ever arrives. Check
journalctl -u smartdforWarning via mail to ... failed. The daemon calls/usr/bin/mailby default, which does not exist unless an MTA orbsd-mailxis installed. Either install one, or bypass mail entirely with-M exec /usr/local/bin/disk-alert.sh— the script gets the message body on stdin and the details in environment variables. - A long self-test never finishes, or restarts from 90%. Self-tests are suspended whenever the drive receives host I/O, so on a busy disk the test makes almost no progress; status
Interrupted (host reset)means exactly that. Schedule long tests for a quiet window, and note that-n standbypostpones a scheduled test on a sleeping disk rather than waking it. - A drive behind MegaRAID returns
INQUIRY failed. TheNin-d megaraid,Nis wrong. Get the real device IDs fromstorcli /c0/eall/sall showand use the DID column, not the slot. On some controllers you also have to address the controller’s own node (/dev/sg0) rather than the virtual disk.
When this is the wrong approach
SMART monitoring is cheap and worth doing, but it fails at several jobs people hand it.
- It is not a substitute for backups. A meaningful share of drives fail with every counter reading clean, and no attribute predicts a controller board failure, a firmware bug or a power event. If your recovery plan depends on being warned first, it is not a plan. Redundancy is the other half — set up an mdadm RAID1 mirror so a single disk failure is an inconvenience rather than an outage.
- It does not work on cloud or virtual disks. A
virtiodisk, an attached block volume, or a device-mapper target has no SMART data to give. On a cloud instance the physical media belongs to the provider, and their health signal is the volume status API, notsmartctl. Monitor what you can actually see — filesystem errors, latency and I/O errors from node_exporter — and let the provider handle the media. - Running smartctl by hand does not scale past a handful of hosts. For a fleet, feed the data into your metrics pipeline instead.
smartctl_exporter, or a cron job writing to the node_exporter textfile collector, turns these counters into time series you can alert on with a rule like “reallocated sector count increased in the last 24 hours” — a better signal than any absolute threshold. - Consumer SSDs under heavy write load need a different metric. There,
Percentage_Usedand bytes written against rated endurance tell you more than any failure counter, because the drive will most likely wear out on schedule rather than fail unpredictably.
Full directive syntax for both tools lives in the smartmontools documentation, and the drive database that gives vendor-specific attributes their proper names is refreshed separately with update-smart-drivedb.
If this is the kind of work you’d rather never own again, it’s the daily job of Managed Cloud Ops — book an infrastructure review.