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.

  • 1
    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... Sep 2 '16 at 18:19
  • 1
    @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... 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
  • 1
    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... Sep 2 '16 at 18:46

I think this should be provided by the defects log, if it is supported:

smartctl -l defects /dev/sdX

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:

defects[,NUM] - [ATA only] prints LBA and hours values from the ATA Pending Defects log (General Purpose Log address 0x0c). Only the 31 entries from first log page are printed by default. This number can be changed by the optional parameter NUM. The size of the log and the order of the entries are vendor specific. The Pending Defects log was introduced in ACS-4 Revision 01 (Mar 2014).


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:

smartctl -t short /dev/sdX

# then wait ~ 1 minute for the test to complete, and check the log:

smartctl -l selftest /dev/sdX

Then you can follow the steps from the smartmontools Docs to deal with the bad sector/block.

  • This looks like it's probably an answer, but I also haven't found any disks that support it and have pending sectors.
    – derobert
    May 13 at 19:20
  • Agreed. I had to use the short selftest to find the LBA of my pending sector, but at least that worked
    – spinup
    May 13 at 23:24
  • The short selftest was discussed a while ago, and it doesn’t reveal all pending sectors apparently... May 17 at 8:02
  • 1
    @StephenKitt Yup, I saw your comment (and voted it up) -- the procedure identified my bad sector right away, so I wanted to highlight it here to encourage others to try it. Of course the implementation may vary among vendors, so it is couched in somewhat wishy-washy language (you may find that ...)
    – spinup
    May 18 at 18:43

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.