Re: Why are bad disk sectors numbered strangely, and what happensto them?
From: Maciej Zenczykowski
Date: Mon Oct 13 2003 - 06:59:47 EST
> Hmm. That could well be an answer. I'll think about it.
> Actually I should just write over the whole partition for the present time.
> When the drive's self-test detected that one bad sector, I could figure out
> which partition it was in (though not which file, which is why I asked one
> of those questions several times already). The drive's self-test read the
> entire drive and the other partitions had no detectable errors.
Instead of zeroing the entire partition just zero that single sector.
dd if=/dev/zero of=/dev/hda bs=512 seek=$lbasector conv=notrunc count=1
possibly first check (by reading in the oposite direction:
dd if=/dev/hda of=/dev/null bs=512 skip=$lbasector count=1)
if this is indeed the place were you get the read error (in syslog)...
if you can read anything from it then read it to a file and write it back
from the file...
as for checking which file contains it... hmm file->sector->lba mapping
can be performed... I don't know about the other direction. Worst case
would require checking the mapping of all files on the partition (and
assuming it's not in an empty area or non-file system area).
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/