Subject: Re: bad sectors on drives ...
To: Steven M. Bellovin <>
From: Malcolm Herbert <>
List: netbsd-users
Date: 12/13/2001 15:20:15
On Wed, Dec 12, 2001 at 10:09:46PM -0700, Steven M. Bellovin wrote:
|>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 ... 
|No, I think you're misreading it.  badsect will create a situation 
|where certain sectors are in two files.  fsck will repair that 
|situation; the guidance above is to tell you to tell fsck which file 
|should keep the sectors, and which shouldn't.  After that, everything 
|will look consistent.

ah ... yes, that makes sense ... badsect will create files in the 
filesystem which may be allocated to the filesystem free list or to
another file.  fsck will complain, but you need to tell it to delete
the _original_ file not the one you created with badsect.  Once done,
the bad sector will always be allocated to the file that badsect 
created and fsck won't cause problems ... 

cool, thanks for the advice ... :)

This doesn't appear to be an old drive ... how many bad sectors do 
people usually tolerate before ditching the drive?

Malcolm Herbert                                This brain intentionally                                                left blank