Subject: Re: Incompatible slices.
To: None <darrenr@cyber.com.au, etheisen@teclink.net>
From: Bruce Evans <bde@zeta.org.au>
List: port-i386
Date: 02/26/1996 19:32:31
>The difference's are because of BIOS geometery.

No, the messages are because the FreeBSD drivers hide the DOS partitions
from the BSD parts of the system.  They are to give enough information
to recover a 386BSD/NetBSD label (with DOS cruft inside the label) after
the drivers have rewritten the label to hide the DOS partitions.

>FreeBSD correctly
>uses the BIOS geo for partition layout.

No, only the FreeBSD sysinstall, fdisk and boot programs use the BIOS
geometry.  The drivers don't use it, but they attempt to determine it
(so that they can reporte it to sysinstall and fdisk) by looking at the
contents of the DOS partition table.  Of course, this can only work if
the partition table is nonempty, and it often gives the wrong results
unless the partition table follows defacto standard conventions.

FreeBSD doesn't determine the BIOS geometry in the "correct" way
because this is very difficult to do automatically.  It would involve
the following steps:

	for each drive supported by the BIOS
		# The following self-referential step is required
		# because many modern SCSI BIOSes attempt to determine
		# the geometry by looking at the partition table.
		Run utilities to write the final partition table.

		# If the drive has Boot Manager on it, then its
		# geometry will probably be different if you boot
		# from a floppy unless you load the BM drivers
		# from the floppy.
		Ensure a standard boot environment.

		Ask the BIOS for the geometry.

		Record this geometry and don't allow it to magically
		change when someone forgets to set up the standard
		boot environment...

		Map this drive to a BSD drive and don't allow the
		mapping to change.
		# The mapping should probably be indexed by the BIOS
		# drive number.  This is hard because the BIOS decides
		# how to assign drive numbers and doesn't tell you.
		# Consider multiple SCSI chains with multiple removable
		# drives (some removed) on each.  Some BIOSes will only
		# see the attached drives...
	end for
	for each drive NOT supported by the BIOS
		Choose a working geometry and don't allow it to magically
		change.

		Don't allow this drive to mutate to a BIOS drive when
		someone changes the cables...

		Map this drive to a BSD drive and don't allow the mapping
		to change.
	end for
	Pass enough info about all drives from the boot stage(s) to the
	kernel.

>NetBSD does it own thing
>based upon a default partioning scheme layed out in the 1st stage
>loader. Or it uses it idea of the drives native geo.  We need to
>work on getting this resolved.  It has caused newcomers serious
>grief. Plus it's partioning scheme is not PC OS compatible.

I think NetBSD allows almost any partitioning scheme to be specified
in fdisk and disklabel.  It's up to the installation programs and
installation people whether it works.

>	1) Partion geo should always be layed out in the MBR in
>	   exact same geo that DOG would use.

See above about the self-referential nature of partitioning.  The
DOG geometry is sometimes determined by the BSD geometry if BSD is
installed first.

>	2) The actual size should be used, not 24MB.

Certainly.

>	3) Same goes for beginning/end addresses.

This is impossible if the geometry isn't know.  Using the wrong geometry
is worse than useless.  There seems to be be a convention that
1023/255/63 means "don't know".

>	3) The first track as defined by DOG should be skipped.
        ^ 4

This is too restrictive since it isn't compatible with using the whole
disk for BSD.  (1)-(3) are probably sufficient for stopping foreign
installation programs from deciding that the partition table is garbage
and reinitializing it.

Bruce