3

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.

  • I don't know of a way to get the complete list, but you could always start with the "UNC at LBA" information from the error logs, and the LBA at which short offline tests abort... – Stephen Kitt Sep 2 '16 at 18:19
  • @StephenKitt The UNC at LBA ones are from when the host ran across the sector on a read—so mdraid immediately corrected those. (Confirmed by trying to read the sector, and also looking at kernel logs). Good idea with the ones from the selftest log, though. [Actually, turns out those have all been fixed—but I can run another short test fairly quickly.] – derobert Sep 2 '16 at 18:24
  • Ah yes, I was thinking of a recent uncorrectable error I had but it was picked up by the extended offline test, not normal operation, so the MD layer didn't get a chance to fix it. So that leaves the selftest logs, in an iterative process... – Stephen Kitt Sep 2 '16 at 18:32
  • @StephenKitt yep, and if I have to do a (new) long self test, I could just use badblocks (r/o mode) or mdraid scrub—and that's if I only had to do one long self test. One per block would take forever. – derobert Sep 2 '16 at 18:34
  • Right, but since the drive already knows which sectors are pending, the short offline tests should abort quickly and give the appropriate info. Iterating over that would be faster than a full scrub... – Stephen Kitt Sep 2 '16 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.