Subject: Re: limiting the error correction attempts in wd driver
To: Laine Stump <lainestump@rcn.com>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: current-users
Date: 12/09/2002 21:37:38
On Mon, Dec 09, 2002 at 02:38:02AM +0200, Laine Stump wrote:
> My mom's hard disk (one of the infamous IBM Deskstars) has bitten the
> proverbial big one, and I'm trying to recover as much of her stuff as
> possible (mostly just email archives, thankfully - all her jpegs of scanned
> family photos were already backed up). Most of the sectors appear to still
> be readable, but every 50 - 1000 sectors there seems to be a bad one.
>
> My first try was to just do:
>
> dd if=/dev/rwd0d of=/dev/rwd1d count=xxx conv=noerror,sync
>
> There are two problems with this:
>
> 1) each time an bad sector is encountered, the kernel retries 6
> times and, as expected, fails all 6. I'm concerned that the
> drive is going downhill *fast*, and don't want to waste time
> or wear/tear doing all those retries - during that time,
> things might get worse and I'd get back less info than I
> otherwise could have (last year I managed to recover my
> wife's entire 6GB laptop drive contents after it dropped
> from a table onto a hardwood floor, but within an hour or
> so after getting the last file, the drive was completely
> unusable).
>
> 2) sectors appear to be read in blocks of 4, so dd gets an error
> on sector 62 4 times - once each when it tries to read sector
> 62, 63, 64, and 65. This means a) there are a total of 24
> retries for each bad sector, and b) (I'm not sure about this)
> possibly the contents of sectors 63-65 will come up as nulls
> even though they may possibly be okay.
No, the driver falls back to single-sector reads specifically to recover
as much data as possible
>
> So, I'm looking for ways to 1) disable retries on wd read failures, and 2)
> unblock the reads, so that failed sectors won't be reread. I took a quick
> look through wdc.c and man pciide, and didn't see any likely constants. Can
> someone give me some hints?
What's you're looking for is in sys/dev/ata/wd.c, WDIORETRIES_SINGLE and
WDIORETRIES.
You want to keep WDIORETRIES_SINGLE at 1 and WDIORETRIES at 2; so that it
will retry in single-sector mode.
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 23 ans d'experience feront toujours la difference
--