Subject: Re: bad sectors on drives ...
To: Malcolm Herbert <>
From: Steven M. Bellovin <>
List: netbsd-users
Date: 12/12/2001 22:09:46
In message <>, Malcolm Herbert writes:

>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.

		--Steve Bellovin,
		Full text of "Firewalls" book now at