Subject: Re: install/13310
To: Wolfgang Solfrank <ws@tools.de>
From: David Laight <david@l8s.co.uk>
List: netbsd-bugs
Date: 05/05/2003 21:06:06
> >>i386 boot disks should have a partition table and the first
> >>partition should not start earlier than the end of the first track.
> 
> I beg to differ.  I'm running most of my machines with real 'whole disk',
> i.e. with the "a" partition starting at sector 0 (or 1, depending on
> how you start counting).  The NetBSD boot code explicitly contains
> a fake mbr partition table in order to support this.

I wouldn't bet on that space remaining available...
 
> I'd even go as far as to call the fact that sysinstall doesn't use
> this when told to use 'whole disk' a bug.

Nope - such disks are unbootable by some BIOS and against the standard
(whatever it is!) that defines the layout for 'PC' disks.

> That said:
> 
> > Use whole disk generates [1]:
> > 
> > # fdisk wd0
> > Disk: /dev/rwd0d
> > NetBSD disklabel disk geometry:
> > cylinders: 4160 heads: 8 sectors/track: 63 (504 sectors/cylinder)
> > 
> > BIOS disk geometry:
> > cylinders: 519 heads: 64 sectors/track: 63 (4032 sectors/cylinder)
> > 
> > Partition table:
> > 0: <UNUSED>
> > 1: <UNUSED>
> > 2: <UNUSED>
> > 3: sysid 169 (NetBSD)
> >     start 63, size 2096577 (1023 MB), flag 0x80
> >         beg: cylinder    0, head   1, sector  1
> >         end: cylinder  518, head  63, sector 63
> > 
> > Which should be valid....
> > (it also looks right for disks >8GB)
> 
> which doesn't look right to me.
> 519*64*63=2092608 which is quite a bit less than
> 63+2096577=2096640.

That is because that is a faked geometry, IIRC the correct geometry
for that volume is the 4160*8*63 = 2096640 which matches the space
allocated by the label.

> Note that some BIOSs try to deduce the geometry of a disk with some
> installed partitions by matching the start/size data with the
> beg/end data, probably in order to allow moving disks from one
> machine to another without repartitioning.

I strongly suspect that some at least verify the values.
Netbsd itself will sometimes use the values - but only as a fallback
if the 'normal' method for identifying the geometry fails.

> When discovering this, I reduced the size of the fake partition
> table in the NetBSD boot code from 50000 sectors to 16 sectors.

> Note that I've got no idea, why the start/size vs. beg/end values
> in your example don't match.

If the 'end' numbers are wrong it could be because that output is from
NetBSD running under bochs (a PC emulater) using a 'disk' that is actually
a vnd device, and it possible I've run a 'native' fdisk on it which
might have cloned some of the geometry of the real disk.....

	David

-- 
David Laight: david@l8s.co.uk