Subject: Re: BIOS / pfdisk / sysinst glitches ?
To: Danny Thomas <D.Thomas@vthrc.uq.edu.au>
From: None <rvb@sicily.odyssey.cs.cmu.edu>
List: port-i386
Date: 07/15/1998 20:02:09
HEADS UP!! IMPORTANT!! READ THIS!!  and OPINIONS SOLICITED!!
HEADS UP!! IMPORTANT!! READ THIS!!  and OPINIONS SOLICITED!!

I did battle with sysinst recently, setting up a few new machines with
a preexisting win 95 partition.  I blew away win 95 and the other MBR
parititions.  This happens IF YOU SET THE BIOS GEOMETRY.  DO NOT SET
THE BIOS GEOMETRY using a existing install floppy or -current, unless
you want the whole disk for NetBSD.  I will commit the fix for this on
Friday to -current.  NOTE: SET BIOS GEOMETRY is an menu that you can
skip, so skip it if you have other OSs on your disk.

Next, D.Thomas@vthrc.uq.edu.au (Danny Thomas) writes:
> Now the curious thing is the installer reports geometry as
>   real geom 6256 cyl, 128 heads, 63 sec
>   BIOS geom 782 cyl, 128 heads, 63 cyl

This happened to me, too.  The problem here is in the readdisklabel()
{arch/i386/i386/disksubr.c} code.  The wdc.c code gets disk parameters
for the disk, which in the above case would be 6256/16/63.  Then
readdisklabel once it finds the MBR record for NetBSD, recomputes the
heads/sectors based on what it reads in the MBR so you get 128/63.
But it neglects to divide the cylinders by the ratio of the increase
in number of heads (8).  So the disklabel is initially wrong.  Now,
right after this mistake, readdisklabel actually reads the official
disklabel from the NetBSD partition, so all the C/H/S number are
reset.  However, in the initialization case -- no disk label, the
default label is wrong.  This code gets the HEADS UP.  I will commit
this code on Friday.  I need to make sure scsi works the same way.
I'm 99.99% sure that this won't effect any existing systems -- just
sysinst installations.

NOW: OPINIONS SOLICITED:
1. I don't think that sysinst should be allowed to change an existing
   MBR record unless the MBR record is NetBSD or is empty.  This
   should protect niave users -- whom sysinst is designed for.  If
   you need to rearrange your MBR -- use fdisk once you are installed.

2. When you set size/offset for an MBR entry, should sysinst round
   the numbers to be multiple of the BIOS cylinder size.  This would
   make it easier for NetBSD to coexist with other OS's.