Subject: Re: Data errors on hard drive
To: Brian de Alwis <bsd@cs.ubc.ca>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-users
Date: 04/12/2003 22:39:30
On Fri, Apr 11, 2003 at 12:33:00PM -0700, Brian de Alwis wrote:
> My hard drive appears to be beginning to develop some bad sectors.
> There are three sectors consistently causing data errors: 11499608,
> 11499610, and 11499611.  There were some other sectors that came
> up previously, all on the same cylinder and tracks, but they've
> disappeared since (drive magically whisked them away, I suppose).
> 
> I had some questions I hoped somebody here might answer. 
> 
>  1. I'm guessing this is pretty serious :-/  Especially given those
>     magically-whisked away sectors; I thought the drive should have
>     remapped them automagically without ever showing a read error?
>     Should I be buying a new drive ASAP?

No, the drive will remap it automatically on a write error. For a read,
it's usually report and error and won't remap it until a write to
this sector happens.
You can force a remap with something like
dd if=/dev/zero of=/dev/rwd0d seek=11499608 count=1
with the filesystem mounted read-only, and force a fsck after it.
Of course this will cause data corruption in the file owning this
sector (unless it's a metadata sector, in which case you'll have a damaged
filesystem).
atactl wd0 smart status
can give you some informations about the health of your drive, especially
about relocated sectors.

> 
>  2. Is there any way of fixing this?  I've never played with
>     bad144, and the few messages I could find had some reservations
>     about its use.

I'm not sure bad144 is the right tool here, I'm not even sure it'll work
for large IDE drives. Anyway, an IDE drive which can't remap sectors any
more should probably be remplaced.

> 
>  3. Is there a convenient way of mapping the block numbers to an
>     actual file?  I couldn't figure out easy magic from fsdb.  I'm
>     doing frequent backups, but it would be lovely to know which
>     files are affected!

Unfortunably no. This would be an usefull thing to add to fsdb

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 24 ans d'experience feront toujours la difference
--