brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: smartctl -l xerror shows the errors a disk logged, and newer drives only log them there

Smart
~/tips/tip-smart-smartctl-l-xerror

sudo smartctl -l xerror /dev/sda

Prints the extended error log of a disk, with the failed commands and when they happened.

SMART attributes give you counters. The error log tells you what went wrong behind them: when it happened in power-on hours, what state the disk was in, and which commands led up to the failure. I’d read it whenever an attribute starts creeping up and I want to know what’s behind the number.

sudo smartctl -l xerror /dev/sda

This prints the Extended Comprehensive SMART error log, the 8 most recent entries by default. Add a number for more, such as -l xerror,32. Where smartctl can, it decodes the error into a short code. UNC is an uncorrectable error in data, the kind that comes with bad sectors. ICRC is an interface CRC error, which points at the connection rather than the platters. IDNF means the requested sector ID wasn’t found.

Say attribute 199, the UDMA CRC error count, went up, and the log shows ICRC entries at the same power-on hours. Then I’d reseat or replace the SATA cable before I’d start worrying about the disk itself.

Why xerror and not the older -l error? The summary log behind -l error only keeps the five most recent errors, and the man page warns that recent drives may report errors only in the extended log, while the summary log is listed as supported and stays empty. So an empty -l error on a newer drive tells you very little. The extended log is ATA only; for an NVMe drive, -l error reads the NVMe Error Information log instead, the 16 most recent entries by default.

Further reading: smartctl man page (smartmontools)

More Smart tips sudo nvme smart-log /dev/nvme0 sudo smartctl -q silent -a /dev/sda sudo smartctl -l devstat /dev/sda sudo smartctl -l scttemphist /dev/sda sudo smartctl -t select,1000000-2000000 /dev/sda All Smart tips (19) All topics

Link