*BSD News Article 20012


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!metro!sequoia!ultima!kralizec.zeta.org.au!kralizec.zeta.org.au!not-for-mail
From: bde@kralizec.zeta.org.au (Bruce Evans)
Newsgroups: comp.os.386bsd.bugs
Subject: Re: bad144 problem?
Date: 22 Aug 1993 12:45:18 +1000
Organization: Kralizec Dialup Unix Sydney: +61-2-837-1183 V.32bis
Lines: 63
Message-ID: <256mjuINN227@kralizec.zeta.org.au>
References: <9322908.27770@mulga.cs.mu.OZ.AU> <1993Aug16.180751.16931@crash> <24qnlt$s4p@hrd769.brooks.af.mil> <1993Aug17.174835.979@fcom.cc.utah.edu>
NNTP-Posting-Host: kralizec.zeta.org.au

In <1993Aug17.174835.979@fcom.cc.utah.edu> terry@cs.weber.edu (A Wizard of Earth C) writes:

>In article <24qnlt$s4p@hrd769.brooks.af.mil> burgess@hrd769.brooks.af.mil (Dave Burgess) writes:
>[ ... ]
>>With a full disk configuration, your bad sector table should be the last
>>track.  There have been problems identified with disk drives that
>>physically have more than 1023 cylinders (which I think the disk in
>>...

>The problem occurs when using BIOS-based boot blocks -- which are *required*
>on translated drives with more than one OS on them, like DOS and *BSD.

Are the BIOS-based boot blocks just too limited to handle translation, or
do they have the same translation bugs as the wd driver?  Ideally the
boot blocks should use exactly the same technology as the driver(s).

>As long as the partition itself (and therefore the initial boot code) is not
>on the wrong side of 1023, a soloution exists, but has not been implemented
>(at least publically and by someone who can release the code).

>The idea is that the first and second stage boots are built such that the
>BIOS-apparent drive parameters are passed to the second stage boot by the
>first stage boot, and *then* the second stage boot goes into protected mode
>and uses direct controller I/O, reads the partition table, and does the
>math using the passed values.  This allows the second stage boot to see the
>bad track table and the kernel, even if it has blocks that live past 1023.

This defeats the point of using the BIOS boot blocks - simplicity.  You
would have to maintain a boot version of every driver (or not boot from
some drives).

I've previously given 2 simple solutions:

(1) ensure that the kernel and directories pointing to it don't contain
    any bad sectors, and ignore the bad sector table for booting.  It is
    fairly easy to keep bad sectors out of the kernel by putting them in
    junk files.  It is fairly easy to keep bad sectors out of directories
    and superblocks by putting the root partition on a (small) part of the
    disk with few errors.

or

(2) put the bad sector table below cylinder 1024.

>A consequence of the parameters being available to the kernel is that the
>kernel can make them available via ioctl() to the fdisk and disklabel
>programs, and all the math can be done for the user automatically  (ie:

The untranslated parameters (according to the drive's switches) are
almost available already for ESDI and IDE drives.  They are read at
driver attach time and are printed by the NetBSD version of the wd
driver.  Unfortunately they are lost in the standard drivers when
readdisklabel() blunders around trying to find the label.  Either there
is no label and the parameters get replaced by bogus ones (the
untranslated ones?), or there is a label and the parameters get
replaced by the ones in the label.  The ones in the label are probably
wrong if they are different.

The translated parameters are available from the BIOS.  They are easy
to ready from BIOS memory at any time provided the bootstrap and
kernel initialization don't overwrite BIOS memory.
-- 
Bruce Evans  bde@kralizec.zeta.org.au