Re: Why are bad disk sectors numbered strangely, and what happens to them?

From: John Bradford
Date: Mon Oct 13 2003 - 05:34:36 EST


Quote from "Norman Diamond" <ndiamond@xxxxxxxxxxxxx>:
> John Bradford replied to me:
>
> > > How can I tell Linux to read every sector in the partition? Oh, I might
> > > know this one,
> > > dd if=/dev/hda8 of=/dev/null
> > > I want to make sure that the drive is now using a non-defective
> > > replacement sector.
> >
> > A read won't necessarily do that. You might have to write to a
> > defective sector to force re-allocation.
>
> I agree, we are not sure if a read will do that. That is the reason why two
> of my preceding questions were:
>
> How can I find out which file contains the bad sector? I would like to
> try to recreate the file from a source of good data.

How are you going to make sure you write it in the same location as it was before?

> How can I tell Linux to mark the sector as bad, knowing the LBA sector
> number?

Don't. If the drive can't fix this problem itself, throw it in the bin.

> And that is also the reason why my last question, which Mr. Bradford replied
> to, had the stated purpose of making sure that the drive is now using a
> non-defective replacement sector after the preceding operations have been
> carried out.

Backup your data.
Run the S.M.A.R.T. tests.
Write over the whole disk with something like dd if=/dev/zero of=/dev/hda.
If you still get errors, replace the disk.

> Please, the important questions are important. Doesn't anyone really know
> what Linux does with bad blocks, how to find out which file contains them,
> how to get Linux to force them to be marked and reallocated?

John.
-
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/