9

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?

PS: 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?

3
  • 1
    Screenshot of the SMART Data : foopics.com/showfull/e20ea820cbed11ae2d99e13a9fe642d1 Hrm..! PS:needs to allow more than one hyperlink, or atleast one image link for new users :-/
    – Vish
    Oct 1, 2010 at 8:14
  • Did you run the "long" test?
    – TJ L
    Oct 1, 2010 at 14:09
  • 1
    Yeah, I tried the "extended" , but i dont get the sector numbers reported. Or Maybe I'm not looking in the right place after running the test?
    – Vish
    Oct 2, 2010 at 16:36

4 Answers 4

7

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.

3
  • 1
    Thanks for the detailed answer. Those three pending sectors existed for a very long time, nearly more than 6months, thats the reason I wanted to fix those pending sectors. And those sectors are in my main /home partition, how do i do this online? You mentioned unmounting all partitions, should i do this from a live cd?
    – Vish
    Oct 2, 2010 at 16:37
  • Since it is the home partition for your installation, you would want to indeed do the above steps from livecd. Do make sure all partitions on the disk are unmounted (including swapping off any swap partitions).
    – koushik
    Oct 3, 2010 at 2:59
  • Thats odd, i'v been having the pending count for nearly 6months with ext4, but when i reinstalled with brtfs it dint go away. Hence i was worried. From you advice i considered waiting for a couple of weeks before i did something. Now Suddenly they are all gone! So i guess waiting was the best. :-) Seemed to resolve faster with btrfs though.
    – Vish
    Oct 11, 2010 at 12:35
1

worse case you can always do this: Unmount the disk or array and stop any array.

dd if=/dev/sdX of=/dev/sdX iflag=direct,sync oflag=direct,sync

It will take a long time, but should work.

Ideally you could query the hard drive growth defect list (glist), but I haven't figured out how to do that.

1
  • "A long time"... Yeah. Now I have a 10Tb HDD and 8 bad sectors... This doesn't sound like a good idea to me. Feb 15, 2021 at 5:04
1

It looks like the conv=noerror option helps. When there is an i/o error it looks like this option forces dd to retry til it completes the read/write. I created a source file with the following command for each of the bad blocks found by the badblocks command (given by Kaushik above), and it cleared the "Current Pending Sector Count" ("waiting to be remapped") to zero from 5.

sudo dd bs=512 count=1 conv=noerror ibs=512 obs=512 if=/dev/sda of=/dev/sda iflag=direct,sync oflag=direct,sync skip=3186809 seek=3186809
1

When this exceeds 0 it is typically a sign of imminent drive failure. I do not believe this can be fixed without replacing the hard disk.

Refer to http://kb.acronis.com/content/9133?nocache=1

2
  • I agree with the statement "replace the HDD ASAP". But for scrap data (data you don't need a backup of), the drive could still be used for years... Feb 15, 2021 at 5:06
  • This is incorrect in the vast majority of cases. ALL modern magnetic media disks have defects. They simply cannot be manufactured with densities in the TBs without. The SMART functions to detect (Current_Pending_Sector) and re-map (Reallocated_Sector_ct) are normal evolutions. Our disk farm is relatively new and already 40% of the (entirely healthy) disks have reallocated sectors. I expect all of the disks will have some reallocated sectors by the time utilization exceeds %50. In the rare cases where degradation is occurring, the SMART "overall-health" assessment will catch it.
    – Frobozz
    Jun 17, 2022 at 14:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .