Reading SMART Attribute Thresholds Before Failure
How smartctl's Reallocated_Sector_Ct, Pending_Sector and CRC_Error_Count values expose failing drives before a RAID rebuild turns risky.

Advertising disclosure: this article includes partner links. KBY may earn a commission if you sign up or buy through one, at no extra cost to you. How we make money.
Underlined words are defined in the KBY Lexicon. Tap or click one to see what it means.
A drive reporting SMART Health Status: PASSED tells you almost nothing about imminent failure. That single bit is the output of firmware-level SMART attribute thresholds comparing a handful of pre-fail counters against manufacturer-defined limits, which the manufacturer chooses for its own purposes, not to protect your dataset.
By the time the overall-health self-assessment flips to FAILED, the window to migrate data off gracefully has usually already closed. For home NAS builders, workstation owners and students running research data on consumer HDDs and SSDs, the actionable signal lives in the raw attribute values and their trend, not the binary pass/fail flag most GUI utilities surface.
#What each row of the SMART table holds
Self-Monitoring, Analysis and Reporting Technology (SMART) is an ATA/ATAPI firmware feature, not an operating-system service. The drive firmware maintains an internal table of attributes, each identified by a numeric ID (1–255, with the meaning of many IDs varying by vendor).
smartctl prints each row in ten columns (ID, Attribute Name, Flag, Value, Worst, Thresh, Type, Updated, When_Failed, Raw_Value), and understanding how firmware compares the normalised Value against Thresh is the entire basis of SMART attribute thresholds monitoring.
The normalised value is a vendor-scaled figure (1–254, higher is healthier); the raw value is the counter you actually care about, such as an uncorrected sector count or a temperature in degrees Celsius disguised inside a 48-bit field.
Querying a drive directly with smartmontools exposes the full table rather than the summarised pass/fail bit:
1$ sudo smartctl -a /dev/sda | grep -A20 "ID# ATTRIBUTE_NAME"
2ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
3 5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail Always - 0
4 9 Power_On_Hours 0x0032 078 078 000 Old_age Always - 19842
5 12 Power_Cycle_Count 0x0032 099 099 000 Old_age Always - 412
6187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0
7188 Command_Timeout 0x0032 100 099 000 Old_age Always - 0
8197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0
9198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Always - 0
10199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0#Pre-Fail vs Old-Age Attributes
Attributes flagged as Pre-fail (Reallocated_Sector_Ct, Spin_Up_Time, Seek_Error_Rate) carry SMART attribute thresholds: once the normalised value drops to or below Thresh, the attribute has failed (smartctl shows FAILING_NOW in WHEN_FAILED), which for a Pre-fail attribute means failure is imminent.
Old_age attributes (Power_On_Hours, Temperature, most CRC/timeout counters) indicate wear and ageing, and many carry a Thresh of 000, as in the output above. smartctl’s manual page defines failure as a normalised value less than or equal to Thresh, and normalised values start at 1, so an attribute with a Thresh of 000 is never reported as failing, however bad the raw value gets.
That is why a drive can report PASSED while its UDMA_CRC_Error_Count raw value keeps climbing. Any monitoring built purely on the firmware’s own verdict inherits this blind spot.

#Watching raw values with smartd and Prometheus
Default SMART attribute thresholds set by drive vendors mark an attribute as failed; they are not designed as an early warning. The practical fix is running smartd as a persistent daemon with attribute-specific overrides, then piping the raw values into a time-series store so trend, not point value, drives the alert.
- Install smartmontools and enable the daemon at boot.
- Define policies in
/etc/smartd.confthat keep-a, which includes the-tattribute tracking, and add explicit raw-value directives for the counters that matter. - Schedule short self-tests daily and extended (long) self-tests weekly during low-I/O windows.
- Export raw attribute values via a textfile collector into Prometheus for delta-based alerting.
Following along? Tap a step’s number to tick it off.
1# /etc/smartd.conf
2DEVICESCAN -a -o on -S on \
3 -s (S/../.././02|L/../../6/03) \
4 -W 4,45,55 \
5 -R 5! -C 197+ -U 198+ -R 199 \
6 -m ops@example.internal \
7 -M exec /usr/local/bin/smart_notify.shLines ending in a backslash continue the same entry. The smartd.conf(5) manual page states that when smartd reaches a DEVICESCAN entry it ignores any remaining lines in the file, so DEVICESCAN goes last and per-device entries go above it.
As smartd.conf(5) documents, -R 5! reports any change in the raw value of Reallocated_Sector_Ct as critical (logged at LOG_CRIT, with a warning email because -m is set); -R ID is a modifier rather than a check of its own: smartd.conf(5) says it modifies the -p, -u and -t tracking directives and has no effect without one of them, and -a includes -t, which is what makes it work here.
-R ID also implies -r ID, so the raw value appears in the log lines. smartd sets -C 197 -U 198 by default, and the + suffix narrows those reports to check cycles in which the raw Current_Pending_Sector or Offline_Uncorrectable count has increased. All three bypass the firmware’s normalised SMART attribute thresholds entirely and react to the counter itself.
-C and -U each take a single attribute ID (the one that holds the pending or offline-uncorrectable count), so use -R to watch any other counter. -R 199 logs changes in the UDMA CRC error count, which usually indicate a failing SATA cable or backplane connector rather than the platter.
It is deliberately left without !, which would log each change as critical and send the same warning email as a disk-health fault.
DEVICESCAN applies these directives to every disk smartd detects, so list drives behind USB bridges or RAID controllers on their own lines with the correct -d type, above the DEVICESCAN line; the scan then skips any device that has its own line.
Back up /etc/smartd.conf before editing it, then restart smartd and check its log on one host before copying the file to others.
1#!/usr/bin/env bash
2# smart_to_prometheus.sh — textfile collector for node_exporter
3OUT=/var/lib/node_exporter/textfile_collector/smart.prom
4TMP="$OUT.$$"
5: > "$TMP"
6for dev in /dev/sd?; do
7 # The smartctl exit status is a bitmask: bit 0 = command line did not parse,
8 # bit 1 = device open failed (or, by default, low-power mode), bits 2-7 = findings.
9 # smartctl(8) gives -n standby,3 as the way to get a unique status for standby:
10 # a real check does not set bits 0 and 1 together, because a command-line error
11 # stops smartctl before it opens the device. A sleeping drive is skipped, not spun
12 # up; every other status falls through and is exported.
13 json=$(smartctl -n standby,3 -a -j "$dev" 2>/dev/null)
14 [ $? -eq 3 ] && continue
15 [ -z "$json" ] && continue
16 serial=$(echo "$json" | jq -r '.serial_number')
17 echo "$json" | jq -r --arg dev "$dev" --arg serial "$serial" '.ata_smart_attributes.table[]? |
18 "smart_attribute_raw{device=\"\($dev)\",serial=\"\($serial)\",id=\"\(.id)\",name=\"\(.name)\"} \(.raw.value)"' >> "$TMP"
19done
20# rename into place so node_exporter never reads a half-written file
21mv "$TMP" "$OUT"With the script run from cron or a systemd timer (every five minutes for drives that never spin down; on spin-down setups, longer than the spin-down timer) and raw values landing in Prometheus, an alerting rule such as increase(smart_attribute_raw{id="5"}[7d]) > 0 catches sector reallocation growth long before the firmware’s own SMART attribute thresholds have any reason to intervene.
#Drives and setups that fool threshold monitoring
Several practical scenarios break naive SMART attribute thresholds monitoring outright.

- Vendor-encoded raw values: the SMART standard does not define how raw values map to physical quantities, and rate-type attributes such as Raw_Read_Error_Rate and Seek_Error_Rate are often vendor-encoded rather than simple counts, so check a drive family’s behaviour before applying week-over-week delta checks to them.
- Hardware RAID abstraction: controllers such as LSI/Broadcom MegaRAID or Dell PERC intercept ATA passthrough.
smartctlagainst/dev/sdain these environments queries the virtual disk, not the physical spindle; you needstorcli/percclior SAS passthrough mode to reach real attribute tables. - NVMe SSDs bypass the classic table entirely: there is no attribute ID/Value/Thresh structure. Health is exposed via the NVMe Health Information log page, read with
nvme smart-log /dev/nvme0, using fields likepercentage_usedandmedia_errorsinstead. - USB bridge chips drop SMART passthrough: many UAS/USB-SATA enclosures used in home NAS builds discard SMART commands without any warning, returning stale or fabricated data, so verify with
smartctl -ibefore trusting any subsequent read. - Non-standard SSD wear IDs: attribute 177 (Wear_Leveling_Count) on Samsung maps roughly to attribute 173 on Micron/Crucial and 233 on some Intel drives, so cross-vendor fleets need a lookup table, not a single hardcoded ID, when applying custom SMART attribute thresholds.
| Attribute ID | Common Name | Vendor Variance | Recommended Action Trigger |
|---|---|---|---|
| 5 | Reallocated_Sector_Ct | Universal (ATA) | Any raw value increase |
| 197 | Current_Pending_Sector | Universal (ATA) | Non-zero for >48h |
| 198 | Offline_Uncorrectable | Universal (ATA) | Any raw value >0 |
| 199 | UDMA_CRC_Error_Count | Universal (ATA) | Cabling/backplane fault, not disk fault |
| 177/173/233 | Wear_Leveling / Media_Wearout | Vendor-specific ID and scale | Normalised value below 10 |
| N/A (NVMe log) | percentage_used | NVMe Health Log, not attribute table | Value >= 90 |
#What polling, self-tests and exported data cost
Rolling this out across a fleet, or even a single home NAS with eight bays, brings costs that pure per-disk monitoring doesn’t surface. Choosing how aggressively to poll and how far to relax vendor-default SMART attribute thresholds has real operational cost:
- Frequent
smartctlpolling wakes drives configured for APM spin-down, defeating the power-saving profiles common on home NAS builds, so align poll intervals with existing spin-down timers. - Extended self-tests compete for I/O: they consume the full seek/read pipeline; scheduling them concurrently across a RAID array during a rebuild window compounds latency exactly when the array is least tolerant of it.
- Old_age counters cause alert fatigue: Temperature and Power_On_Hours change constantly and generate noise if wired into the same alerting path as Pre-fail attributes, so keep the rule groups separate.
- Exporting raw SMART data (serial numbers, firmware revision) via an unauthenticated metrics endpoint leaks hardware identity useful for physical asset correlation; scope the node_exporter textfile endpoint behind the same network ACLs as other internal telemetry.
- Refurbished or relabelled drives can give false negatives: some resellers reset Power_On_Hours or Reallocated_Sector_Ct counters via vendor tools before resale, so treat a suspiciously pristine attribute table on a “new” drive as a data point, not a guarantee.
None of this replaces a proper backup strategy, and SMART attribute thresholds, whether firmware-default or custom-tuned, remain a probabilistic early-warning signal rather than a deterministic failure predictor.
Treat a breached threshold as sufficient justification to start a migration, not as proof a drive is already dead, and treat a clean report as an argument for continued monitoring rather than an all-clear.
The underlying architectural patterns for this kind of telemetry (daemon collection, textfile export, time-series delta alerting) generalise well beyond storage and are worth building once, properly, rather than re-implementing per NAS chassis.
#Related reading
Evidence trail
Sources and verification
Primary documentation and external technical references used in this article.
About this page
Credited to
Dates
Published
Last updated
Found this useful? Follow KBY for more like it.
Related labs
Calculators and what-if tools that go with this article.
Recommended reading
More from KBY that goes with this article.
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.
Engineering insights, direct to you.
Receive the latest Systems Engineering tutorials, production guides, Engineering Labs and operational best practices.


Comments
Add a thoughtful note on Reading SMART Attribute Thresholds Before Failure. Comments are checked for spam and held for moderation before appearing.