Subject: Re: Booting sd0 (disk geometry versus bios geometry)
To: None <port-i386@NetBSD.ORG>
From: Todd Whitesel <toddpw@best.com>
List: port-i386
Date: 07/10/1998 18:46:55
> Does this mean you told sysinst to use the "real" disk geometry for
> the MBR/bios partition table, or when writing a BSD label to the start
> of the NetBSD MBR-partition of the disk?

I'm _not_ _sure_ because the prompts and man pages are not very clear.
That's why I need to redo my installation and take good notes. I do other
weird things, like having a tiny root partition (23 MB) at the very end of
the BIOS geometry, and I have the tarballs on a custom CD-R I burnt myself
(no relation to the normal directory tree). Until I am sure how much is
pilot error and how much is sysinst/utils, I hesitate to make certain
statements about what is or isn't flat out wrong with the current tools.

I do seem to be painting myself into a corner with respect to volunteering
to work on sysinst+friends, though.

> (FWIW, my experience with 1.2 is that I could _never_ do an install
> without getting the "erase entire disk?" message from /sbin/disklabel.
> That was trying to install into a formerly-Linux bootable partition,
> one of two factory-installed Linux partitions on a ~1gig SCSI on a
> Buslogic controller.)

    (void) printf("Erase the previous contents of the disk? [n]: ");

Bingo!! That's the Prompt Of Doom. What I finally discovered after throwing
printf's into disklabel was that I couldn't use cylinders to specify the
NetBSD area, because the DOS partition map had a head's worth of sectors in
the first cylinder reserved for private boot blocks or whatever. Disklabel
was happier when I used sectors to specify the NetBSD area as starting at
exactly the same sector as the NetBSD-typed DOS partition. I probably could
have fixed it in the DOS partition map, but I decided not to take the risk.

> Is the problem, maybe, that you're trying to specify a disklabel(5)
> geometry, the geometry is passing sysinst's checks, but writing the
> BSD disklabel is failing?

At least some of what I observed suggests that disklabel is doing stuff
behind sysinst's back, blasting the block 0 MBR instead of just the NetBSD
area boot blocks.

> I havent ever had a successful install with the 1.2 tools, so I dont
> now for sure, but AFAICT they wouldn't cope any better with a disk
> that has more than 1024 cylinders.

They can. You just have to be careful. Here is my weirdo boot disk:
    BIOS   Geom: 1024 cylinders, 64 heads, 32 sectors.
    NetBSD Geom: 2063 cylinders, 64 heads, 32 sectors.
    The first partition (DOS primary) is 250 cylinders and holds win95.
    The second partition (DOS extended) is 750 cylinders; my CD-R staging area.
    The third partition (NetBSD typed) is 23 cylinders; it is my NetBSD sd0a.
    In the 1st & 3rd partitions, 32 sectors are 'reserved' for boot blocks,
    so the actual partitions start 32 sectors into the first cylinder.
I told the 1.2 installer to use my BIOS geometry, but entered exactly the
right sector numbers to put the NetBSD area at the start of the third
partition and extended it out to the end of the disk. During the install
something roasted my DOS partition map but the DOS utility I used was able
to fix it, and System Commander was then able to boot everything correctly.

With 1.3 I tried to get it to use the BIOS geometry for booting but the
real geometry for NetBSD, which was probably misguided because my NetBSD
area did not begin at the front of a real cylinder. At first it didn't want
to let me allocate NetBSD partitions beyond the tiny 23 MB partition, but I
found that one of the partition editing menus caused it to recompute what
it thought was the available disk area, and I was able to continue. This is
something I still don't understand very well, which is part of why I keep
saying that I need to redo it and take notes.

> You have two choices: set up an MBR slice and make sure your root
> partition fits eniterly within the C/H/S boundaries of the MBR and the
> BIOS; or (assuming your BIOS isn't doing its own translation behind
> the scenes!!) construct a fake C/H/S geometry for the disk in the MBR,
> dividing C by 2 or 5 and multiplying S or H correspondingly.

I believe I have always satisfied the first option. It's possible that I
ran off the end of the BIOS geometry by a fractional cylinder; in that case
then I will probably be able to make a case for improving the diagnostic
messages.

> Sometimes the problem really _is_ that a user fed the SCSI mode-sense
> geometry into the MBR, causing chaos. I'm not sure what we can do
> about that.

Oh, there's something. I've really come to appreciate the SunOS model where
you optionally run 'format' before starting the installation. Any partition
map left on the disk by 'format' supplies the defaults for the installer,
which auto-sizes partitions based on what packages you select to install,
and lets you fine-tune just the partition sizes without allowing any of the
other disklabel information to be edited.

Todd Whitesel
toddpw @ best.com