Subject: Re: partition sizes?
To: Space Case <wormey@eskimo.com>
From: None <rvb@sicily.odyssey.cs.cmu.edu>
List: port-i386
Date: 08/18/1998 10:49:43
wormey@eskimo.com (Space Case) writes:

> 
> So, would something like this work?
> 
> 1.  100MB  NetBSD root
> 2.  100MB  NetBSD swap
> 3.  3GB    Win/DOS
> 4.  rest   NetBSD usr
> 

A lot of info has gone by.  Let me summarize and generalize.  First,
BIOS has its idea of partitions.  In the BIOS world, you can have up
to 4 partitions per disk.  Each partition "should" describe a non
overlapping region of the disk.  DOS or NT or win95 all live in such a
partition, as do any of the bsd systems or linux.  (It is mostly not
possible to have two or more of the same kind of partition for any
OS.)  Now the IMPORTANT thing about partitions is that in the MBR
(Master Boot Record) the start of a partition is specified in terms of
cylinder/head/sector location.

When BIOS was designed many many years ago, they set aside a 10 bit
field for cylinders, 8 bit for heads and 6 bit for sectors.
(Actually, they use 3 8 bit bytes and do some shuffling, but ...)  10
bits gives you at most 1023 cylinders, which can be off by a factor of
10 or 20 given today's large disks.  So the disk manufacturers have
chosen in their BIOS to use a fake geometry that can describe the
whole disk rather than describe the disk correctly.  One such choice
is to divide the number of cylinders till the number of cylinders is
below 1023 and then to multiply the number of heads by that same
number.  Most disk controllers (I've seen) are smart enought to use
the true disk geometry or to use a "translation scheme" to do
something sensible with the BIOS GEOMETRY.  What BIOS thinks is
appropriate for cylinder/heads/sectors MAY HAVE NO PARTICULAR RELATION
AS TO WHAT THE TRUE DISK GEOMETRY IS.  You must ask BIOS what is
correct for the disk.  On the otherhand, when netbsd runs it uses lba
(logical block addressing) for disk addresses so details about disk
geometry are irrelevant to it.  ONCE IT RUNS ...

Now, lets tie this all together.  I prefer to put win/dos at the start
of the disk although you could put it at the end (just beware of >
8Gig disks and fat32x).  The next BIOS partition could be for NetBSD.
It really doesn't matter how far into the disk netbsd is.  You just
need to know how to translate the start block address into
cylinder/head/sector notation using BIOS geometry.  (If you get the
geometry wrong, you will be able to install netbsd, but not boot it
w/o a floppy.)  The community has been struggling with a correct way
to get the BIOS geometry.  What I prefer to do is to either use dos
fdisk or the pfdisk utility in our installation tools to do find it.
You could use dos fdisk to create your initial BIOS/DOS area.  By
convention, this tool uses full cylinders.  (I didn't mention earlier
that BIOS also stores the end cylinder/head/sector in the MBR.)  So
NetBSD looks at the end cylinder/head/sector of the bios partition to
intiut the BIOS geometry.  Alternatively, you can run pfdisk <unit>
and type l which will list the geometry.  You can also use pfdisk to
create a partition for BIOS and/or NetBSD.

Now you can begin to install netbsd.  You verify that when it presents
you with the BIOS geometry that the numbers are correct.  This will
then let NetBSD make a correct entry for its start address in the MBR.

As netbsd installs, it creates its own view of the disk, the bsd
disklabel.  This is independent of the BIOS partitions.  Further,
slices in the bsd disklabel might correspond to a DOS partition which
is outside of the NetBSD range of the disk (from the MBR's point of
view).  I believe that when you specify the disk geometry for the disk
label it is always ok to use the true disk geometry.  (Although, in my
own use I've occasionally used the BIOS geometry here as well.  But
this can have some other problems ...)  I also prefer to have the
NetBSD partition begin and end on BIOS disk geometry boundaries.
(Currently, the easiest way to do this is to use pfdisk to put the
NetBSD (emtpy) partition onto the disk using "BIOS/DOS" tools.  You
can put it anywhere at the front, end or middle of the disk very
simply.  (Note: the NetBSD partition type is 165 (for 1.3.x systems)
and 169 for current systems.)