Subject: Re: bad sectors on drives ...
To: None <>
From: Malcolm Herbert <>
List: netbsd-users
Date: 12/13/2001 17:45:04
On Thu, Dec 13, 2001 at 03:20:15PM +1100, Malcolm Herbert wrote:
|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

[ snip ]

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

[ snip ]

|cool, thanks for the advice ... :)

hmmm ... I'm having trouble working out how to specify sectors to 
badsect - I obviously put the wrong numbers in, since once I'd added
all the bad sectors, badsect had made the files, re fscked the drive
and so on, I still got the kernel errors when I wrote to the disk.

Presumably the numbers I fed into badsect weren't those that covered
the bad sectors ... according to the man page:

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

however all the messages I get from syslog (and on the console) appear
to be device-based numbers and not relative to the beginning of the 

|Dec 13 18:14:14 tethys /netbsd: sd0(ahc1:2:0):  Check Condition on CDB: 0x2a 00 02 3b 90 cf 00 00 10 00
|Dec 13 18:14:14 tethys /netbsd:     SENSE KEY:  Media Error
|Dec 13 18:14:14 tethys /netbsd:    INFO FIELD:  37457166
|Dec 13 18:14:14 tethys /netbsd:      ASC/ASCQ:  Peripheral Device Write Fault
|Dec 13 18:14:14 tethys /netbsd:      FRU CODE:  0x10
|Dec 13 18:14:14 tethys /netbsd:          SKSV:  Actual Retry Count: 24

I'm presuming the INFO FIELD is the sector I'm after, however how does
this translate into a filesystem relative sector?  The disklabel
looked like this (I will be recreating it later, I just nuked it 
temporarily in order to do a full write test of the drive to flush
out any other bad sectors):

|tethys[~] 41v#: disklabel -i /dev/rsd0d
|partition> P
|8 partitions:
|#        size   offset     fstype   [fsize bsize cpg/sgs]
|  a: 21923937       63     4.2BSD     1024  8192     6   # (Cyl.    0*- 1499)
|  b: 332676001 21924000     4.2BSD     1024  8192     6   # (Cyl. 1500 - 24261*)
|  d: 354600001        0     unused        0     0         # (Cyl.    0 - 24261*)

hmmm ... so would disk sector 37457166 would end up being filesystem
/dev/rsd0b sector 15533166?  where does the filesystem begin in a
partition (ie, is there an offset I need to apply rather than just doing
a simple <disk sector> - <partition offset>)?

anyway, I'll let the write test complete before I go further, in case
there are any more bad sectors to find ...


Malcolm Herbert                                This brain intentionally                                                left blank