Predict disk failure from health telemetry
What you’re probably seeing right now
- An alert at a bad hour: “predictive failure”, “reallocated sectors increased”, “SMART warning”, “disk degraded” on a host you would rather not touch tonight.
- The controller’s web interface shows one drive in amber. Or the server front panel has an amber light on one bay.
zpool statussaysDEGRADED,/proc/mdstatshows[U_], or Storage Spaces reports a disk asWarning.- Applications feel slow. Reads stall for seconds while the disk retries.
- Someone asks: “Can’t we just pull it and put a new one in?” Maybe. Not yet.
First 5 minutes
Your hands, in this order:
- Write down host, alert time, and the disk’s serial number from the alert. The serial is what matters, not the device name or the bay number.
- Check redundancy: is the array or pool still fully redundant, or already degraded?
- Check the last backup of everything on that array: did it succeed, when?
- Read the counters yourself and compare them with the history.
Do not touch, yet:
- Do not pull a disk by bay number or device name alone. Names like
/dev/sdbcan change between boots, and bay numbering differs between vendors. - Do not start a long self-test, scrub or big copy job on an already degraded array. It adds stress to the disks you still need.
- Do not mark the disk as failed or remove it from the array before the replacement is ready.
What to tell the manager, and when: after step 3.
“A disk on [host] is showing early failure signs. The data is [still fully redundant / running without redundancy] and the last backup is from [time]. I plan to replace it [tonight / in the next window]. No outage expected.”
If the array is already degraded, change the last sentence to: “We are one disk away from data loss. I need to replace it tonight.”
If you see this, do that
Is the pool or array still redundant?
ZFS:
zpool status -x
zpool status tank-example
Healthy · example output
all pools are healthy
Degraded, one side of a mirror faulted · example output
pool: tank-example
state: DEGRADED
status: One or more devices are faulted in response to persistent errors.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Replace the faulted device, or use 'zpool clear' to mark the device
repaired.
config:
NAME STATE READ WRITE CKSUM
tank-example DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
ata-EXAMPLE_OLD_SERIAL FAULTED 12 0 0 too many errors
ata-EXAMPLE_PEER_SERIAL ONLINE 0 0 0
errors: No known data errors
Linux software RAID:
Both members up · example output (cat /proc/mdstat)
Personalities : [raid1]
md0 : active raid1 sdb1[1] sda1[0]
976630464 blocks super 1.2 [2/2] [UU]
bitmap: 1/8 pages [4KB], 65536KB chunk
unused devices: <none>
One member failed · example output
Personalities : [raid1]
md0 : active raid1 sdb1[1](F) sda1[0]
976630464 blocks super 1.2 [2/1] [U_]
bitmap: 3/8 pages [12KB], 65536KB chunk
unused devices: <none>
- Fully redundant, only a warning: replace in the next planned window. Order the disk now.
- Degraded (
DEGRADED,[U_],(F)): you have no safety net. Check the backup, then replace as soon as you have a disk. Keep load low until then. errors:lists files with permanent errors: data is already damaged. Stop and escalate; restore those files from backup.
Is the counter climbing, or a one-off?
smartctl -H -A /dev/disk/by-id/ata-EXAMPLE_OLD_SERIAL
Passed, counters at zero · example output (excerpt)
SMART overall-health self-assessment test result: PASSED
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail Always - 0
197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 0
Still “PASSED”, but sectors failing · example output (excerpt)
SMART overall-health self-assessment test result: PASSED
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
5 Reallocated_Sector_Ct 0x0033 097 097 010 Pre-fail Always - 184
197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 24
198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 24
The overall verdict says PASSED in both. Do not let that word calm you down. The raw values on the right are what changed.
- Raw values rising since the last reading: plan the replacement.
- One jump after a known event (power cut, cable reseat), flat since: keep watching. See Rollback, “false alarm”.
Is this the right physical disk?
Make the bay light blink for the exact disk, and check the serial on the label before you pull anything:
ls -l /dev/disk/by-id/ | grep EXAMPLE_OLD_SERIAL # which /dev/sdX is that serial right now?
ledctl locate=/dev/sdb # Linux, ledmon package (newer releases: ledctl --ibpi locate=/dev/sdb)
Enable-PhysicalDiskIdentification -FriendlyName "PhysicalDisk3" # Windows Storage Spaces
Behind a hardware RAID controller, use the controller’s own “locate” or
“blink” function. When the disk is out, turn the light off again
(ledctl locate_off=/dev/sdb, Disable-PhysicalDiskIdentification).
Warning
Pulling the wrong disk from a degraded array destroys it. With one side of a mirror already failed, the disk you pull by mistake was the last copy. Blink the bay, read the serial on the label, compare it with the serial in the alert, and say both out loud to a second person (or on the phone) before you pull.
Warning
mdadm --remove, zpool detach and Remove-PhysicalDisk take a disk out of redundancy for good. Run them
only on the disk whose serial you confirmed, and only after the replacement has finished rebuilding.
Stop and escalate when
- A second disk in the same array shows rising counters, or fails during the rebuild.
- The pool reports files with permanent errors, or the file system goes read-only.
- The last backup of that data failed or is older than your RPO.
- You cannot match the alert’s serial number to a physical bay.
- The controller reports a cache, battery or backplane fault, not only one disk. That is a hardware vendor case.
What prediction can and cannot do
Summary. Disks often show warning signs before they die: sectors being reallocated, reads that fail and are retried, NVMe spare capacity running low, wear climbing toward its rated limit. Collected daily and compared over time, these numbers let you swap a disk in a maintenance window instead of at 3 in the morning during a rebuild. Be honest about the limit: many disks fail without any warning in their health data. Prediction reduces surprises; it does not replace redundancy, backups or normal monitoring.
Check before you use this. All hostnames, IPs, device names and serial numbers below are example data (RFC 5737, RFC 1918, example.com). Attribute names and meanings differ between disk models and firmware; check current vendor documentation for your disks and controllers.
A human decides. The rule or model raises a flag. A person reads the counters, checks redundancy and backups, and decides to replace. No automatic disk removal from a production array.
Trigger
This runbook has two parts. Set up once per environment, then act each time a prediction alert fires:
- a reallocated, pending or uncorrectable sector count increased since the last reading,
- an NVMe
critical_warningis non-zero, available spare is close to its threshold, or media errors increased, - SSD or NVMe wear (
percentage_usedor the vendor’s wear indicator) passed your planning threshold, for example 80 %, - the OS or controller reports a disk as “predictive failure”, “warning” or “degraded”,
- a disk stopped reporting health data at all.
Immediate action
Set up: collect the telemetry
- Inventory. For every disk record host, slot, serial, model, size, install date and the array or pool it belongs to.
- Collect daily and keep the history with timestamps. A single reading tells you little; the change between readings is the signal.
# Linux, SATA/SAS: full health data as JSON (smartmontools 7 or newer)
smartctl -j -a /dev/sda > /var/lib/diskhealth/$(hostname)-sda-$(date +%F).json
# Linux, NVMe: health log
smartctl -j -a /dev/nvme0 > /var/lib/diskhealth/$(hostname)-nvme0-$(date +%F).json
nvme smart-log /dev/nvme0 # human-readable view: critical_warning, available_spare, percentage_used, media_errors
# Disks behind a hardware RAID controller are often hidden from the OS.
# smartctl can sometimes reach them with -d (example: MegaRAID-type controller, disk 2):
smartctl -a -d megaraid,2 /dev/sda
# If not, use the controller vendor's own CLI or management interface.
# Windows: health and reliability counters per physical disk
Get-PhysicalDisk | Select-Object FriendlyName, SerialNumber, MediaType, HealthStatus, OperationalStatus
Get-PhysicalDisk | Get-StorageReliabilityCounter |
Select-Object DeviceId, Temperature, Wear, ReadErrorsUncorrected, WriteErrorsUncorrected, PowerOnHours
-
Watch these counters (SATA/SAS SMART attribute IDs in brackets; not every disk reports every one):
- Reallocated sectors (5), reported uncorrectable (187), command timeout (188), current pending sectors (197), offline uncorrectable (198)
- NVMe:
critical_warning,available_sparevsavailable_spare_threshold,percentage_used,media_errors - Windows:
ReadErrorsUncorrected,WriteErrorsUncorrected,Wear
-
Write the rule. Start simple and explainable: any increase in the sector and error counters, any NVMe critical warning, wear above the planning threshold, or a disk that moves much faster than its siblings of the same model and age. A statistical or ML model can rank disks by risk on top of that, but keep the simple rule as the floor.
# Example: flag disks whose error counters went up since the previous reading.
# Input: CSV with date,host,serial,attr,value (one row per counter per day). Example data only.
import csv
from collections import defaultdict
WATCH = {"5", "187", "188", "197", "198", "media_errors"}
hist = defaultdict(list)
with open("diskhealth-example.csv") as f:
for r in csv.DictReader(f):
if r["attr"] in WATCH:
hist[(r["host"], r["serial"], r["attr"])].append((r["date"], int(r["value"])))
for (host, serial, attr), rows in hist.items():
rows.sort()
if len(rows) >= 2 and rows[-1][1] > rows[-2][1]:
print(f"CHECK {host} {serial} attr {attr}: {rows[-2][1]} -> {rows[-1][1]} on {rows[-1][0]}")
- Route the alert to the person who can order and swap hardware, with host, slot, serial and the counter history in the alert text.
Act: when a prediction alert fires
- Backups first. Confirm the latest backup of everything on that disk, array or pool succeeded and is restorable. If not, run and check a backup before any disk work.
- Check redundancy. Is the array or pool still fully redundant? If it is already degraded, treat this as urgent: a second failure means data loss.
- Read the counters yourself and compare with the history. A single jump from a known event (power loss, cable reseat) is different from a steady climb.
- Do not stress a degraded array with long self-tests or big copy jobs unless you have to. Protect the data first.
- Replace in a planned way. Use the platform’s own replace procedure, so the array rebuilds onto the new disk while the old one is still readable where possible.
# ZFS: replace a disk in place (example device ids)
zpool status tank-example
zpool replace tank-example /dev/disk/by-id/ata-EXAMPLE_OLD_SERIAL /dev/disk/by-id/ata-EXAMPLE_NEW_SERIAL
# Linux software RAID (mdadm): add the new disk as a spare, then copy onto it
# while the old disk stays in the array (--replace keeps redundancy during the copy)
mdadm --manage /dev/md0 --add /dev/sdc1
mdadm --manage /dev/md0 --replace /dev/sdb1 --with /dev/sdc1
cat /proc/mdstat # when done, the old disk shows as faulty (F)
mdadm --manage /dev/md0 --remove /dev/sdb1
# Windows Storage Spaces: retire the suspect disk, repair, then remove it (example names)
Set-PhysicalDisk -FriendlyName "PhysicalDisk3" -Usage Retired
Get-VirtualDisk | Repair-VirtualDisk
Get-StorageJob # wait until repair jobs are finished
Remove-PhysicalDisk -StoragePoolFriendlyName "Pool-Example" -PhysicalDisks (Get-PhysicalDisk -FriendlyName "PhysicalDisk3")
For hardware RAID, follow the controller’s documented replace or “copyback” procedure. Pull the disk by slot and serial number, never by slot alone.
- Log it. Alert time, counters, decision, who replaced what, and when.
Verification
- The rebuild, resilver or repair finished without errors (
zpool status,/proc/mdstat,Get-StorageJob, controller log). - The array or pool is fully redundant again.
- The new disk reports health data and is in the inventory with its serial number and install date.
- The removed disk’s serial is marked as replaced in the inventory.
- The alert is closed, not muted.
Rollback
- False alarm before replacement: if the counters were a one-off (for example after a cable or backplane fault that you fixed) and stay flat for the next readings, close the alert with the reason. Keep the disk on a short watch list.
- New disk fails during rebuild: stop, check backups again, and do not remove further disks. If the old disk is still in place and readable, leave it in the array until a working replacement has finished rebuilding.
- A rule is too noisy: roll the rule back to the last version that people trusted, and record why. Do not mute disk health alerts as a whole.
- Removed disks: keep a failed or suspect disk labelled and stored securely until it is wiped or destroyed according to your data handling rules. It still contains data.
After it’s back up
- Rebuild or resilver finished with no errors, and the array is fully redundant again.
- Old serial marked as replaced, new serial and install date in the inventory.
- Locate light turned off.
- Removed disk labelled and stored securely until it is wiped or destroyed. It still holds data.
- Alert closed with a note: counters, decision, who replaced what, times.
- Note for the quarterly review: did the prediction come early enough?
Prevention
- Review predictions quarterly. How many alerts led to a real failure, how many were false, and how many disks failed without any warning? Adjust the thresholds from that, not from a feeling.
- Keep spares for the disk models you run, sized to your lead time.
- Do not trust prediction more than the data allows. Keep redundancy, tested restores (see the restore testing routine) and normal monitoring.
- Watch the collector itself: a disk that stops reporting is an alert.
- Data privacy: disk telemetry is usually not personal data, but host names and inventories can be sensitive. Do not send them to an external AI service without approval.
Diagrams
Simple view: from reading to replacement
Diagram source (Mermaid)
flowchart TD
C["Collect disk health<br/>every day"] --> T["Compare with<br/>last readings"]
T --> D{"Counters rising<br/>or warning set?"}
D -->|"no"| C
D -->|"yes"| A["Alert to the<br/>hardware owner"]
A --> B["Check backups<br/>and redundancy"]
B --> H{"Person confirms<br/>the trend?"}
H -->|"no, one-off"| W["Close with reason<br/>watch list"]
W --> C
H -->|"yes"| R["Planned replacement<br/>rebuild"]
R --> V["Verify redundancy<br/>update inventory"]
V --> CTechnical view: telemetry pipeline
Example data: storage host stor01-example at 10.20.0.11, collector at 10.20.0.50, on-call notified by the alerting system.
Diagram source (Mermaid)
sequenceDiagram
autonumber
participant H as stor01-example 10.20.0.11
participant C as Collector 10.20.0.50
participant R as Rule or model
participant O as On-call admin
H->>C: daily smartctl JSON, NVMe health log, reliability counters
C->>C: store with timestamp per serial number
C->>R: latest reading plus history
alt counter increased or critical warning
R->>O: alert with host, slot, serial, counter history
O->>H: check backups, redundancy, raw counters
O->>H: planned replace, rebuild or resilver
O->>C: mark old serial replaced, new serial added
else no change
R->>C: no alert, keep history
end
Note over C,O: no data from a disk is its own alert