[ltp] Bad hard drive sector

Theodore Ts'o linux-thinkpad@linux-thinkpad.org
Mon, 16 Jan 2006 09:39:43 -0500


On Mon, Jan 16, 2006 at 11:28:25AM +0100, Florian Reitmeir wrote:
> On Son, 15 J??n 2006, Bill Sheppard wrote:
> > So it looks like rewriting the sector cleared the error, at least for now.
> > Thanks everyone for the input...
> Maybe you want to give "badblocks" a try, it can force sector relocation.

Badblocks in read/write mode can force sector relocation; the sector
only gets relocated on an attempted *write* to the sector.  Of course,
as soon as you do that, the original data is lost forever, so in
general most OS's will not automatically force bad block relocation
when a read error is detected, in the hopes that the maybe the error
is transient --- and the desire to allow the user to explicitly make
the decision to abandon a certain piece of data.  Unfortunately, there
doesn't seem to be a good way to get the list of blocks for which
errors have been reported (other than manually grovelling through
system logs).

So the simplest and safest (if not the fastest) way of forcing the bad
block relocation to take place is to run e2fsck -cc /dev/hdXXX with
the filesystem unmounted.   

						- Ted