Hardware Health Monitoring: Temperature, SMART, and Disk Lifespan
Use smartctl, sensors, and nvme to routinely inspect disk health and temperatures on a physical server—catch failing drives before they take your data.
Why proactive checks matter
Hardware failures on physical (dedicated) servers rarely strike without warning. Bad sectors creep up on a disk, an SSD burns through its write endurance, or a clogged heatsink lets the CPU throttle under heat. By the time a drive drops offline for good, you've usually already lost data. Routine inspection surfaces these warning signs while there's still time to act.
Install the tools
sudo apt update
sudo apt install -y smartmontools lm-sensors nvme-cli
sudo sensors-detect --auto # detect temperature sensors on first run
Reading disk SMART with smartctl
Start with the overall health:
sudo smartctl -H /dev/sda # health self-assessment (PASSED/FAILED)
sudo smartctl -a /dev/sda # full attribute dump
A PASSED verdict is reassuring but coarse—drives routinely fail while still reporting PASSED. What you really want to track are the attributes below, whose raw values should stay at 0 or climb only very slowly:
- ReallocatedSectorCt — sectors already remapped; a nonzero, rising count is your cue to replace the drive
- CurrentPendingSector — suspect sectors queued for remapping
- OfflineUncorrectable — sectors that couldn't be recovered
- WearLevelingCount / MediaWearoutIndicator — SSD wear (the normalized value falls toward end of life)
Kick off a self-test:
sudo smartctl -t short /dev/sda # short test, ~2 minutes
sudo smartctl -t long /dev/sda # long test, full surface scan
sudo smartctl -l selftest /dev/sda # review the results
Temperatures with sensors
sensors
Check the per-core CPU temps and the motherboard reading. Values sitting near the high or crit thresholds point to a cooling or fan problem. Pair it with watch -n 2 sensors to watch the curve while the box is under load.
NVMe endurance with nvme smart-log
sudo nvme smart-log /dev/nvme0
The fields that matter most:
- percentageused — endurance consumed; plan a swap as it approaches 100%
- availablespare — remaining spare blocks; dropping below availablesparethreshold is an alert
- mediaerrors / criticalwarning — anything nonzero deserves attention
- temperature — NVMe drives throttle when they overheat, too
Schedule checks and alerts
Don't rely on remembering to look. Run a daily cron job that pings you only when something is wrong:
# /etc/cron.daily/disk-check
sudo smartctl -H /dev/sda | grep -q PASSED || echo "sda SMART failing" | mail -s "Disk alert" [email protected]
Better still, let smartmontools' own daemon do the watching: set thresholds and email notifications in /etc/smartd.conf, and smartd will monitor in the background and warn you automatically the moment ReallocatedSector starts creeping up.
Summary
Effective hardware monitoring is about trends, not single readings: bad sectors, SSD wear, and spare capacity only move one way, so degradation shows up weeks in advance. Fold smartctl -H, nvme smart-log, and sensors into a daily cron sweep, wire the key metrics into alerting, and keep independent backups of anything that matters—monitoring buys you a calm, planned drive swap; it's no substitute for a backup.