STORAGE ENGINEERING

SMART monitoring & disk health prediction

Category: Disk HealthTechnologies: smartmontools, smartctl, smartd, nvme-cli, Backblaze stats

SMART (Self-Monitoring, Analysis and Reporting Technology) is built into most ATA/SATA and SCSI/SAS drives. It monitors internal attributes and can run self-tests to predict failure, though it is not a guarantee. Research shows roughly 36% of drives fail without tripping any SMART threshold.

smartctl commands

# All SMART information
smartctl -a /dev/sda

# Health status only (PASSED/FAILED)
smartctl -H /dev/sda

# Device identity
smartctl -i /dev/sda

# SMART attributes
smartctl -A /dev/sda

# Error log
smartctl -l error /dev/sda

# Self-test log
smartctl -l selftest /dev/sda

# Run short self-test (1-2 minutes)
smartctl -t short /dev/sda

# Run long self-test (can take hours)
smartctl -t long /dev/sda

# Run conveyance test (transport damage)
smartctl -t conveyance /dev/sda

# Comprehensive output (more than -a)
smartctl -x /dev/sda

Key SMART attributes (ATA)

IDNameMeaningWhen to worry
5Reallocated_Sector_CtSectors remapped to spare areaAny non-zero value. Google 2007 study: ~14× higher failure rate.
187Reported_Uncorrectable_ErrorsUncorrectable errors reported to hostNon-zero: data loss likely
197Current_Pending_SectorSectors pending reallocation (unreadable)Non-zero is urgent
198Offline_UncorrectableSectors that failed offline scanNon-zero: elevated failure risk (treat like SMART 197)
199UDMA_CRC_Error_CountCable/backplane/HBA errorsIncreasing: infrastructure issue, not drive failure
9Power_On_HoursHours powered onNot a failure indicator; track for age/EOL planning
194Temperature_CelsiusDrive temperatureSustained high temps or sharp swings; consult vendor spec for thresholds
233Media_Wearout_Indicator (SSD)Remaining endurance (100 → 1)Below 10-20

Backblaze, monitoring 67,000+ drives, uses attributes 5, 187, 188, 197, and 198 as their main failure predictors.

smartd configuration

smartd is a daemon that monitors drives continuously and sends alerts. Configuration lives in /etc/smartd.conf (or /etc/smartmontools/smartd.conf on Debian).

# Monitor all devices, all attributes, email alerts
DEVICESCAN -a -m root@example.com

# Health status only + email
DEVICESCAN -H -m root@example.com

# Specific device: short test daily at 2 AM, long test Saturday 3 AM
/dev/sda -a -m root@example.com -s S/../.././02 -s L/../../6/03

Test scheduling format: -s TYPE/../../DAY/HR where TYPE is S (short), L (long), or C (conveyance); DAY is 0-6 (0=Sunday); HR is 0-23.

# Enable and start
sudo systemctl enable --now smartd

# Test email alert
smartctl -t short /dev/sda  # trigger a test
# or:
smartd --testmail

NVMe SMART

NVMe uses a standardized log page format instead of vendor-specific attributes. Use nvme-cli:

# Display SMART log
nvme smart-log /dev/nvme0

# Display for specific namespace
nvme smart-log /dev/nvme0n1
AttributeMeaning
critical_warningBit field; non-zero means a critical issue
percentage_usedEndurance consumed (0 → 100). Most important NVMe wear indicator.
data_units_read / data_units_written512-byte units read/written (reported in TB/PB)
media_errorsCount of unrecoverable data errors
available_sparePercentage of spare capacity remaining
temperatureReported in Kelvin and Celsius directly

Interpreting SMART data

SMART is not a guarantee

Manufacturer SMART algorithms have a failure detection rate of only 3-10% with a 0.1% false alarm rate. Some failures (controller failure, firmware bugs) occur suddenly with no SMART warning. Always maintain backups regardless of SMART status.

Normalized vs raw values

ATA SMART attributes have a normalized value (typically 1-253, higher is better), a worst value, a threshold, and a raw value. The normalized value is what the manufacturer's algorithm watches. The raw value is the actual count, useful for trend analysis but vendor-specific in meaning.

When to replace a drive

Monitor trends rather than absolute values. A single reallocated sector on a 5-year-old drive is less urgent than 50 new ones in a week.

Automated monitoring

# /etc/smartd.conf, email alerts with scheduled tests
DEVICESCAN -a -m admin@example.com -M daily \
  -s S/../.././02 \
  -s L/../../6/03

# -M daily: send one email per device per day (not per alert)
# -M test:  send a test email on daemon start
# -M exec /path/to/script: run a script instead of email
# Example alert script
#!/bin/bash
# /etc/smartd_warning.sh
# $SMARTD_DEVICE, $SMARTD_FAILTYPE, $SMARTD_MESSAGE available
echo "SMART alert on $SMARTD_DEVICE: $SMARTD_MESSAGE" | \
  mail -s "SMART warning: $SMARTD_DEVICENAME" admin@example.com
# Or send to Slack/PagerDuty/etc.