Two slices, two FreeBSDs

Hi everyone,

I rent a dedicated server with one HDD. Unfortunately, during the installation (thanks to their administration tool), it's not possible to change the partition scheme. Moreover, the only "rescue mode" they provide is an Ubuntu which means that if there is a mistake in the firewall config file (for example) and I can't reach the server through ssh, it's over, I have to re-install...

So, there is a solution : in VirtualBox, I create a virtual HDD and cut it in 2 slices (MBR partition table). The first one (ad4s1) will be my own rescue FreeBSD and the second (ad4s2) will be the production one. I send the image on the server, and do the proper business to make it run.
That way, if problems, I should be able to switch my server on "Ubuntu rescue mode" and use fdisk to set active ad4s1. I reboot the server in "normal mode", it boots on ad4s1 and I can fix the issue on the production FreeBSD (ad4s2)then set active ad4s2 and reboot again.

But it doesn't work : when there are multiple OSes, boot0 ask to hit F1, F2... and the default is the last one used which is not very cool for a server that is 1000 km away :)

To sump up I'd like to switch between the rescue and the production FreeBSDs just setting active ad4s1 or ad4s2 thanks to fdisk (or a tool available in Ubuntu). Is there a way to do that?

Thank you very much :)
 
Check the man page for boot0cfg(8), and especially option -s.
Also, if you want your main slice (ad4s2) as the default no matter which one you booted last, just boot it and then use the -o noupdate option to prevent the boot manager from updating the partition table again, thus making it permanent.

I believe you can also edit the partition table and set the active slice at any time using
# fdisk -u ad4
 
Ok but even when I set active a slice (for example ad4s1), if boot0 is set to boot on the other one (ad4s2), I will not boot on the actived slice (ad4s1)...
 
You must be doing something wrong. How are you activating ad4s1?

Setting a slice active means changing the partition table, which is stored in the MBR/boot0. That's the only way of doing it and fdisk and boot0cfg both change the same location.
 
well, I do it like that:
Code:
fdisk -a /dev/ad4s1
or
Code:
gpart set -a active -i 1 ad4
 
These look okay. But post #3 is contradictory.

It's possible the two slices are somehow both being activated and the system is confused.
After you run one of those commands in post #5, check which slice is active with
% fdisk /dev/ad4
It's flag 80 (active) vs. flag 0.

You can always correct a 2-active-slices situation with
# fdisk -u /dev/ad4
 
Back
Top