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 sataphy counts smart link errors between drive and controller

Smart
~/tips/tip-smart-sataphy-counters

sudo smartctl -l sataphy /dev/sda

Helps separate a bad cable or port from a bad disk.

When a disk throws errors, the disk gets the blame. Sometimes the link between drive and controller is the real culprit, and the drive keeps counters for exactly that link.

Print the SATA Phy Event Counters:

sudo smartctl -l sataphy /dev/sda

Each line has an ID, a size, a value and a description, for things like CRC errors in frames and retries or resets on the link. Mostly zeros is what you hope for. A few counts can come from normal events such as booting, so one small number is not a reason to panic.

The useful move is to compare. Note the values, run a large read or copy, and look again. Counters that climb during traffic point toward the cable, the backplane or the port. Swap the cable, move the drive to another port, and see whether the climbing stops.

The counters can be cleared with a reset variant, which makes that before and after comparison cleaner:

sudo smartctl -l sataphy,reset /dev/sda

It prints the old values and then zeroes them, so save the output if you want to keep the history. This only changes these link counters, never your data or the SMART attributes.

I’d only rely on this for SATA devices, and drives behind a USB bridge or some RAID controllers may not pass the log through. SAS disks keep comparable information under the same option name but in a different layout.

Further reading: smartctl man page

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