bad sector in gmirror HDD

Daniel Kalchev daniel at digsys.bg
Sat Aug 20 06:43:38 UTC 2011


On Aug 20, 2011, at 06:24 , Jeremy Chadwick wrote:

> You might also be wondering "that dd command writes 512 bytes of zero to
> that LBA; what about the old data that was there, in the case that the
> drive remaps the LBA?"

If you write zeros at OS level to an LBA, you will end up with zeros at that LBA. What else did you expect???

The already remapped LBAs in ATA are not visible anymore to the user/OS. You get a perfectly readable sector. Of course not at the original location, but as you confirmed we are done with CHS addressing.

The pending bad sectors are almost always 'corrected', that is, remapped when you write to that LBA.

So your script will find only one readable sector and that will be the sector that is pending reallocation.

It may be that writing zeros to all free space, like

dd if=/dev/zero of=/filesystem/zero bs=1m; rm /filesystem/zero

is enough to remap the pending bad block and not have any unreadable sectors. But if the unreadable sector is in a file or directory -- bad luck -- these will need to be rewritten.

Once upon a time, BSD/OS had wonderful disk 'repair' utility. It could detect failing disks by reading every sector (had nice visual), or could re-write the drive by reading and writing back every sector. On bad blocks it would retry lots of times and eventually average what was read (with error).
Having said that, I doubt modern ATA drives will let anything be read by the pending bad block, but.. who knows.

Daniel



More information about the freebsd-stable mailing list