Subject: Re: 2 bootable NetBSD partitions?
To: <>
From: David Laight <david@l8s.co.uk>
List: netbsd-help
Date: 04/03/2002 18:46:36
On Mon, Apr 01, 2002 at 11:28:13AM +0100, brook@biology.nmsu.edu wrote:
> I would like to have 2 bootable MBR partitions for NetBSD (ID 169) on
> one disk:  one for the -release version and one for -current.  Are
> there any problems with such a setup?
> 
> I presume I can do the following to make it work.  Is this correct?
> 
> - create two MBR partitions
> - designate each as partitions in the NetBSD disklabel
> - install the OS in each
> - the kernels must code their root filesystems to refer specifically
>   to the appropriate partitions, e.g.,
> 
> 	config		netbsd	root on wd0a type ffs	# one kernel
> 	config		netbsd	root on wd0h type ffs	# other kernel
> 
> Have I missed anything?

Yes... the way the boot sequence works!

Unfortunately the PC boot sequence doesn't (usually) pass through
any indication of the (dos) partition number through to subsequent
layers of the boot process.

This means that the pbr code rescans the partition table in the
mbr (sector 0) in order to reload the rest of itself.
The kernel startup code also does the same.
The effect is that it the netbsd disklabel is always read from
the same partition regardless of the partition you think have
booted.

Note that the netbsd bootloader will let you load a kernel from
any slice of any disk that the systems BIOS can read.  So you
can interrupt the boot and type 'boot hd0h:netbsd'...
I think the kernel will pick root from that filesystem (unless
you have explicitly build a kernel with a fixed root device).

IMOH using the bootselect code is more appropriate for completely
separate systems.  I have got modified versions of the mbr, pbr,
kernel startup and fdisk programs that make this work.
(avaialble from www.l8s.co.uk then look in 'netbsd')

Remember that netbsd disklabel references absolute sector numbers
it can reference any parts of the disk.


	David

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