Ubuntu – How to fix Current Pending Sector Count


From the SMART Data, it shows that I have 3 pending sector counts. (Running Ubuntu Maverick.)

I tried following a forums link regarding how to solve that, but I'm not able to identify the exact sector count to write to that sector. I've run the full self test from the Disk Utility, but the disk Utility does not show the exact sector number in Maverick, not sure about earlier versions though. Has this changed in Maverick?

How do I identify the sector and fix that pending count? Is that tip in the forums safe?

I do have other issues with "Reallocated Sector Count" , from what I've googled, it's not fixable.. Is there any way to prevent it from rising?

Best Answer

This is actually a long comment ;-)

IMO the filesystem should automatically take care of it in due course, especially since you have run the self test. As you can see it states remapping is done on the event of write failure so the next time it tries to attempt to write to it, it will get remapped.

Could you state the larger purpose behind doing this ? Apart from the concern on the blocks requiring remapping, is there any other annoyance / problem you are trying to solve by doing this ?

The tip in the ubuntuforums post you have quoted is safe so long as you know exactly which sector has gone bad and have a compelling reason to fix it. Typically the sector # is not reported even by file checking programs since it is abstracted and handled internally by the file system.

But if you must find the offending badblocks you can use the below steps :

  1. Note the device file corresponding to file system. This is of the form /dev/hdc or /dev/sdb depending on the disk type. This is displayed in the Disk Utility (System -> Administration -> Disk Utility). If you click on the disk name in the list displayed in the left-side panel, the device name can be read against "Device :" on the right.

  2. Unmount all the file-systems in that disk. The following command should return no output.

    mount | grep -i <device-name>
  3. Run the following command

    badblocks -sv -b 512 <device-name>

    Note The -b 512 is to align blocksize to 512 so you can use the number reported by this command as input to dd as explained in the forums post

I would not recommend all the above since it is anyway taken care of by the normal disk operations.