Subject: Re: Disk partitioning (again, sigh)
To: Ken Hornstein <kenh@cmf.nrl.navy.mil>
From: None <rvb@sicily.odyssey.cs.cmu.edu>
List: port-i386
Date: 07/31/1998 08:06:04
Ken Hornstein <kenh@cmf.nrl.navy.mil> writes:

> Now, the question(s) I have are:
> 
> - Does my analysis make sense?  (One of these days I'm going to understand
>   this whole mess completely!)
Yes, it happens too often.

> - Is there a way to determine the "correct" translated geometry
Yes, use pfdisk and ask it to show you the geometry.  I believe a
simple "list" will do this.

>   associated with an IDE drive?  BTW, the BIOS on this machine
>   _SAYS_ it's using the "correct" geometry (4000+ cylinders), so
Its ok to have > 1024 cylinders.  I'll bet that the C/H/S of the
physical medium was 4000/16/63.  The standard LBA hack is to 
reduce the cylinders (in this case) by a factor of 4 and increase
the heads so the C/H/S would be 1000/64/63. This is what BIOS would
expect.

>   I'm assuming that gets translated _somewhere_ ... or am I completely
>   off-base?
above.

> - Do MBR partitions have to start on a cylinder boundry to work
>   correctly?
Not at all. pfdisk and other tools might warn you, but the only
constraint is that the C/H/S in the MBR boot record points to
the start of the OS.

> - As I understand it, the crucial limitation is that the BIOS only
>   has enough bits for 1023 cylinders, so the other parameters have
>   to be made larger so the cylinders can be made smaller.  Is that
>   right?
Exactly.  10 bits for cylinders, 8 bits for heads and 6 bits for sectors.
So you max out at 1023 x 255 x 63.  Note this is only 8Gig.

> 
> --Ken  


Epilog:
If you have a DOS MBR partition on your disk or let pfdisk set down
the netbsd partition, the MBR will internally contain the 
correct BIOS geometry.  NetBSD will find this info from the MBR and
tell you what the BIOS geometry is during sysinst.
The real mistake here is that on an empty disk or one without an
MBR set up properly, NetBSD will get the BIOS geometry wrong.  So
this info should be passed in from the boot program or other source
of BIOS geometry info.
(I know people are going to complain that you don't know the mapping
of bios disk to netbsd disk.  99% of the time this is not an issue.)