Return-Path: <foner@media.mit.edu>
Received: from pacific-carrier-annex.mit.edu by po11.mit.edu (8.9.2/4.7) id DAA29515; Mon, 20 May 2002 03:27:36 -0400 (EDT)
Received: from out-of-band.media.mit.edu (out-of-band.media.mit.edu [18.85.16.22])
	by pacific-carrier-annex.mit.edu (8.9.2/8.9.2) with ESMTP id DAA18212;
	Mon, 20 May 2002 03:22:40 -0400 (EDT)
Received: (from foner@localhost)
	by out-of-band.media.mit.edu (8.9.3/8.9.3/MEDIA) id DAA08044;
	Mon, 20 May 2002 03:22:24 -0400 (EDT)
Date: Mon, 20 May 2002 03:22:24 -0400 (EDT)
Message-Id: <200205200722.DAA08044@out-of-band.media.mit.edu>
From: Lenny Foner <foner@media.mit.edu>
To: sommerfeld@orchard.arlington.ma.us
CC: marc@mit.edu, tytso@mit.edu, jmorzins@mit.edu, sipb@mit.edu
In-reply-to: <200205200401.g4K41OG04862@syn.hamachi.org> (message from Bill
	Sommerfeld on Mon, 20 May 2002 00:01:23 -0400)
Subject: Which hard disk vendor do you trust?
CC: foner@media.mit.edu

    Date: Mon, 20 May 2002 00:01:23 -0400
    From: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>

    > but if it was simply a matter of the drive writing bogus data during
    > some "event", it would have spared out the sector and continued.
    > This acts like it -can't- spare it out.)

    If the drive fails to recover the contents of a sector, it returns an
    I/O error to the host software so it knows the data isn't there any
    more; a subsequent write will then cause the sector to be spared. 

Hmm.  This contradicts other descriptions I've heard about some drives
eventually giving up and returning a block of zeroes, but maybe I'm
misremembering or the other description was confused.  (One of those
was on the SpinRite site, I believe, which seems unlikely to be
confused, but who knows.  I'm more inclined to believe your
explanation, because it's the sensible way to design things.)

    You get painted into a corner when the host can't overwrite the sector
    until it knows what it previously contained ...

Yeah.  Presumably, the TiVo was in exactly that case, for example.
(See below.)

    When I get the occasional sticky bad sector, I generally get out the
    bit tweezers (dd, specifically), overwrite it with zeros, and run an
    fsck pass to clean up any dangling pointers.  At least with
    BSD-derived filesystems, the main thing I seem to run into is bad
    inode blocks -- since they're *always* handled in a read-modify-write
    pattern, the "spare-on-write" behavior never gets invoked.

    I've seen this sort of thing work on MSCP, SCSI, and IDE disks, under
    hp-ux, 4.xbsd on vaxen, and pc's running netbsd.

In my (most-recent) case, I simply dd'ed the drive to a spare, going
1M at a time except in the two damaged regions, and going 1k at a time
there. I was left with only 2 1k blocks that were irretrievable, which
I left uninitialized on the new disk.  I put the new disk back into
the TiVo and it dropped into what the hacker community calls the Green
Screen of Death, but is in reality its version of fsck for its strange
MFS filesystem.  (The bad block was in a database containing what
shows are on when; it was obvious from my inspection of neighboring
blocks.)  After about 75 minutes, it finished, booted, and then
re-downloaded the relevant schedule slices over the phone line and
rebuilt its database.

A previous click-of-death failure, oddly enough, did -not- click when
I did a similar dd (I was sure I never wrote to the source disk!---
and hence nothing got spared, if sparing only happens on writes).
I found that remarkable, but perhaps the drive was only failing on
9 out of 10 reads for the damaged sector, instead of -every- read.
In that case, of course, the new drive was bit-for-bit identical and
the TiVo didn't notice its replacement.

Nonetheless, I'd like to stop having to do this every 3-6 months.
I mean, I can see wasting my time watching TV, but wasting my time
doing sysadmin so I can watch TV? :)
