smartd
will happily log messages like this:
Sep 2 12:33:59 Watt smartd[438]: Device: /dev/sda, 2 Offline uncorrectable sectors
Sep 2 12:34:01 Watt smartd[438]: Device: /dev/sdc, 16 Currently unreadable (pending) sectors
Sep 2 12:34:01 Watt smartd[438]: Device: /dev/sdc, 16 Offline uncorrectable sectors
These are all used for mdraid arrays, so it's easily fixable by having mdraid scrub the array. But that takes a good long while (and hurts performance while its going). It'd be much quicker to selectively scrub only the parts that need it.
Is there some way to get the list of pending sectors from the disk? I didn't see anything in smartctl -x
, but here is sda and sdc in case it helps. (And yes, sdc is destined for replacement soon.) If I could get a list of sectors, I could feed that to mdraid to scrub only those portions.
These are all SATA disks. The machine is running Debian testing/unstable, if it matters. But I'd love to solve this on machines running Debian stable and oldstable as well.
Best Answer
I think this should be provided by the defects log, if it is supported:
However, I'm unable to confirm, because the message I get from my drive is
Pending Defects log (GP Log 0x0c) not supported
. From the smartctl man page:Alternative
If the defects log is unsupported on your drive, you may find that a short self-test will check the pending sector and immediately abort with a read error, giving you the LBA in the process:
Then you can follow the steps from the smartmontools Docs to deal with the bad sector/block.