Multi-boot Linux + FreeBSD
Lucas B. Cohen
lbc at bnrlabs.com
Sat Nov 24 17:08:49 UTC 2012
Hi Ralf,
On 2012.11.24 17:06, Ralf Mardorf wrote:
> Perhaps later today I'll install 9.0 amd64. If possible I'll keep my
> Linux GRUB legacy. Can I use my menu.lst [1] and add a chainloader or
> something similar to boot FreeBSD from /dev/sda1?
I don't know if GRUB v1 allows that, on a multiboot system I use GRUB 2
to either load FreeBSD's loader(8) :
menuentry "FreeBSD (Loader)" {
insmod part_bsd
set root='hd0,msdos2,bsd1'
echo "Loading FreeBSD loader"
kfreebsd /boot/loader
echo "Starting FreeBSD loader"
}
or to run its kernel directly, after having passed it optional device hints:
menuentry "FreeBSD (Direct Boot)" {
insmod ufs2
set root='hd0,msdos2,bsd1'
echo "Loading FreeBSD kernel"
kfreebsd /boot/kernel/kernel
echo "Loading FreeBSD environment"
kfreebsd_loadenv /boot/device.hints
set kfreebsd.vfs.root.mountfrom=ufs:/dev/ada0s2
echo "Booting FreeBSD"
}
I'm not saying it's impossible, but I'm unable to chainload to the
loader code on my system with this:
menuentry "FreeBSD (Chainload)" {
insmod chain
set root='hd0,msdos2'
chainloader +1
}
> FWIW I made backups of my HDD's MBRs.
> I wonder if the installer will overwrite the MBR?
Always a good thing to have backups. From what I've experienced and
read, 9.0-RELEASE's installer is not always predictable in that regard,
it's probably safer to assume it'll won't do what you want, and just
restore your MBR after the installation, to go back to using GRUB for
dual-booting.
Here's the pitfall, though: the MBR also holds the partition table. So
make a fresh backup after you've created/reorganized the primary
partitions (slices) on your disk using a tool you're familiar with.
(Logical partitions and BSD partitions are stored differently, so they
will survive an MBR restore, provided it doesn't modify the primary
partition they're contained in.)
> I also would like to know, if there's a way to recover the partition
> table, including a primary FreeBSD partition/slice, if this ever should
> get broken and there should be no backup of the partition table be
> available.
The partition table is held alongside the MBR, in the first logical
sector of your disk. Restoring one will restore the other.
For extra safety, you can save the output of partitioning tools like
fdisk or GNU parted expressed in sectors.
Hope this helps,
More information about the freebsd-questions
mailing list