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

_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"

Reply via email to