Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Aug 2011 09:43:23 +0300
From:      Daniel Kalchev <daniel@digsys.bg>
To:        Jeremy Chadwick <freebsd@jdc.parodius.com>
Cc:        freebsd-stable@freebsd.org, Dan Langille <dan@langille.org>
Subject:   Re: bad sector in gmirror HDD
Message-ID:  <65623662-0232-4599-B633-6D207A4CF15A@digsys.bg>
In-Reply-To: <20110820032438.GA21925@icarus.home.lan>
References:  <1B4FC0D8-60E6-49DA-BC52-688052C4DA51@langille.org> <20110819232125.GA4965@icarus.home.lan> <B6B0AD0F-A74C-4F2C-88B0-101443D7831A@langille.org> <20110820032438.GA21925@icarus.home.lan>

next in thread | previous in thread | raw e-mail | index | archive | help

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=3D/dev/zero of=3D/filesystem/zero bs=3D1m; 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?65623662-0232-4599-B633-6D207A4CF15A>