Subject: Re: bad sectors on drives ...
To: Matt Doughty <>
From: Malcolm Herbert <>
List: netbsd-users
Date: 12/13/2001 15:08:21
On Thu, Dec 13, 2001 at 01:56:34PM +0900, Matt Doughty wrote:
|There are utilities that will systematically write, and read to find bad
|sectors. I would tend to think that your scsi card should be able to run
|the tests, and remap intelligently.

true ... however they tend to nuke all the data on the drive as well ...
I did see them when I was setting up the machine, so I might try that
as a last resort ...

On Wed, Dec 12, 2001 at 09:54:16PM -0700, Steven M. Bellovin wrote:
|You can try
|	dd if=/dev/xx0c of=/dev/null
|to scan the whole surface.

that is similar to what I'm doing already: 

sh -xc 'while true; do dd if=/dev/zero bs=1024k count=128 of=`date +%s`; done'

... I'll then move the dud files out of the way once it fills the disk
and delete the rest

|As for marking the bad sectors -- well, badsect looks to be usable but 
|with some limits.  I have no idea if bad144 still works, or on what 

I found badsect just after I'd sent the original email, unfortunately
the manual implies you have to give up on ever doing non-interactive
fscks again:

|badsect is used on a quiet file system in the following way: First mount
|the file system, and change to its root directory.  Make a directory BAD
|there.  Run badsect giving as argument the BAD directory followed by all
|the bad sectors you wish to add.  The sector numbers must be relative to
|the beginning of the file system, but this is not hard as the system re-
|ports relative sector numbers in its console error messages.  Then change
|back to the root directory, unmount the file system and run fsck(8) on
|the file system.  The bad sectors should show up in two files or in the
|bad sector files and the free list.  Have fsck(8) remove files containing
|the offending bad sectors, but do not have it remove the BAD/nnnnn files.
|This will leave the bad sectors in only the BAD files.

I'm not sure I want to do that ... 

Malcolm Herbert                                This brain intentionally                                                left blank