From owner-freebsd-hardware Mon Jan 26 09:00:59 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA14990 for hardware-outgoing; Mon, 26 Jan 1998 09:00:59 -0800 (PST) (envelope-from owner-freebsd-hardware@FreeBSD.ORG) Received: from alpo.whistle.com (alpo.whistle.com [207.76.204.38]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA14982 for ; Mon, 26 Jan 1998 09:00:52 -0800 (PST) (envelope-from julian@whistle.com) Received: (from daemon@localhost) by alpo.whistle.com (8.8.5/8.8.5) id IAA19688; Mon, 26 Jan 1998 08:52:43 -0800 (PST) Received: from UNKNOWN(), claiming to be "current1.whistle.com" via SMTP by alpo.whistle.com, id smtpd019685; Mon Jan 26 08:52:38 1998 Date: Mon, 26 Jan 1998 08:49:12 -0800 (PST) From: Julian Elischer To: John Polstra cc: freebsd-hardware@FreeBSD.ORG Subject: Re: SCSI bad block handling? In-Reply-To: <199801261639.IAA21681@austin.polstra.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hardware@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The disk driver has an ioctl to force a remap. it's commented out only because I didn't know where to put the ioctl definition. we use it at TFS so it works. On Mon, 26 Jan 1998, John Polstra wrote: > Mike Smith wrote: > > > You may then need to actually write to the blocks before they will > > be reallocated, which will generally involve using dd to plaster > > the entire disk (unless you write a program to write to just the > > offending parts of the raw device). > > Attached is a quickie program I wrote a while ago for just this > purpose. It first reads the block and saves its original contents, > both in memory and in a file on disk. Then it bashes the block on > disk with several fixed patterns and then several random patterns, > trying to provoke a write error and force the disk to remap the block. > Finally, it restores the block from its original data. It has worked > well for me to get a few troublesome blocks remapped. Also, it has > the nice property that it won't remap a block that just isn't bad. > > As I mentioned, it was a quickie, so don't expect a software > engineering marvel. In particular, the block number is hard coded > into main(). :-O The fix for that is left as an exercise for the > reader. > > John > -- > John Polstra jdp@polstra.com > John D. Polstra & Co., Inc. Seattle, Washington USA > "Self-knowledge is always bad news." -- John Barth > >