Wednesday, October 8, 2008

2nd Install, 1 Disk

Here is the problem I'm trying to solve: I have an Intel Mac Mini that I'd like to dual boot multiple versions of OpenBSD. I need to be able to boot into another instance of OpenBSD remotely and without a serial port, I had to come up with a way to choose which OS I want to boot to.

I installed OpenBSD 4.4-current normally on wd0a (wd0b = swap, wd0d = /tmp, wd0e = /var, wd0f = /usr and wd0g = /home).

Here is how I set the machine up with OpenBSD 4.3 installed on wd0h.

While booted to OpenBSD 4.4-current (on wd0a), I created and formatted /dev/wd0h and copied OpenBSD 4.3's bsd.rd to it. Then I rebooted. At the boot> prompt, I typed hd0h:/bsd.rd. Then, I went through the installation as I normally would. I set partition mount points up as I normally would (d = /tmp, e = none, f = none, g = none, h = none, i = /var, j = /usr). Note that I am using the same /tmp. I also want to use the same /home, but I don't want /home formatted, so I will add it to wd0h:/etc/fstab later. Also note that I typed 'none' for wd0h. Then, when I'm told that "The next step *DESTROYS* all existing data on these partitions!", I typed ![enter] to escape to a shell and ran the following commands:

sed -e 's/wd0a/wd0h/' /tmp/filesystems > /tmp/fs.mwe
cp /tmp/fs.mwe /tmp/filesystems

This tells the OpenBSD installer that my / filesystem is wd0h instead of wd0a. At this point, I typed yes and wd0h and my other new partitions were formatted. Then, I watched the install proceed normally. The bootloader was overwritten. If that's a problem, it's easily fixed by booting back into -current (or whatever's on wd0a) and running /usr/mdec/installboot -v /boot /usr/mdec/biosboot wd0.

To change which installation is going to boot, mount /dev/wd0a, if necessary, and edit wd0a:/etc/boot.conf:

set device wd0h

Whenever I want to boot back into wd0a, I remount /dev/wd0a, edit my boot.conf and reboot.