*BSD News Article 2459


Return to BSD News archive

Path: sserve!manuel!munnari.oz.au!mips!mips!news.cs.indiana.edu!ux1.cso.uiuc.edu!roundup.crhc.uiuc.edu!uivlsisd.csl.uiuc.edu!terry
From: terry@uivlsisd.csl.uiuc.edu (Terry Lee)
Newsgroups: comp.unix.bsd
Subject: Bad144 sector mapping tips
Date: 24 Jul 1992 21:41:09 GMT
Organization: Coordinated Science Lab., Univ. of Illinois at Urbana-Champaign
Lines: 45
Message-ID: <l70u7lINNbh2@roundup.crhc.uiuc.edu>
NNTP-Posting-Host: uivlsisd.csl.uiuc.edu
Keywords: bad144

	Thanks Bill and Lynne for making 386BSD possible!  For anyone who is
trying to get bad144 bad sector mapping to work for MFM/RLL/ESDI drives, here's
some tips and anomalies (?) I've discovered:

1.  The install program might not put the 'sf' flag (enable bad144 handling) in
    the disklabel.  The output of 'disklabel -r wd0' should have a line that
    says "flags: badsect".  If 'badsect' is not there, use 'disklabel -e wd0'
    to put it there.

2.  According to INSTALL.NOTES, when a bad sector is accessed, an error message
    should indicate the bad sector number.  So far, I've only gotten an error
    message (and not in the form given in INSTALL.NOTES) when the bad sector
    is in the swap partition.  And the sector number reported is relative to
    the start of the 386BSD partition (bad144 expects sector numbers relative
    to cylinder 0).

3.  Be sure to use 'bad144 wd0 0' to first clear the bad sector list.

4.  To find bad sectors in the 386BSD partition, use
    'dd if=/dev/wd0c of=/dev/null bs=512'.  If error 5 is reported, then a bad
    sector is found.  For example, let's assume the offset of wd0c is 200000.
    If 'dd if=/dev/wd0c of=/dev/null bs=512' reports

    error 5 ...
    13500+0 records in
    13500+0 records out

    then sector #213500 (relative to cylinder 0) is bad.  However, the last
    part of /dev/wd0c (one cylinder + 126 sectors) is reserved for bad sector
    mapping; don't try to map any bad sectors found in this area!

5.  According to INSTALL.NOTES, 'bad144 -a wd0 213500' (for our example) should
    have done the trick.  But on my system, 'bad144 -a -c wd0 213500' is
    needed.  Is this a bug?

6.  Repeat steps 4 and 5 until all bad sectors (except those in the last
    cylinder + 126 sectors) are mapped out (I know, yech!).  This is not very
    elegant, but it works.  I'll try to write a program sometimes to do this
    better.  Is someone already working on this?

	I hope this helps someone.  Of course, standard disclaimers apply!

----------
Terry Lee
terry@uivlsi.csl.uiuc.edu