2/27/2014

Dual booting Ubuntu 12.04 and FreeBSD 10

Well first install Ubuntu, creating a separate /boot partition with 256MB space, a 10GB-ish Ubuntu partition, and leave free space at the end of the hard drive for FreeBSD.
Now install FreeBSD. Boot from USB Disk, chose Install FreeBSD, partitioning for beginners. This will auto-detect the space you've left out earlier for FreeBSD; don't type anything to the Mount Path, it will automatically create a master partition, where it handles the mount points automatically. Unless of course, you want a different partition-setup which you do with the tool here.
Be sure to have the / mounted to a UFS-formatted partition (this should be done for you automatically if you've followed the earlier steps), and proceed with the installation.
After the FreeBSD installer finished and you reboot your computer, you'll get the Linux bootloader, of course with no option to start FreeBSD. So here we go, let's fix GRUB:
sudo grub-probe -d /dev/sda1 -t fs_uuid  
should tell you the disk you have a UUID for. That should be your FreeBSD disk - now replace my UUID with yours for grub:
sudo vi /etc/grub.d/40_custom
should fire you up VI, here's my file:
menuentry 'FreeBSD' {
   insmod ufs2
   insmod bsd
   search --fs-uuid --no-floppy --set=root 011c86ed-6f2d-48a0-a132-f020c23a045c
   kfreebsd /boot/kernel/kernel
   kfreebsd_loadenv /boot/device.hints
   set FreeBSD.vfs.root.mountfrom=ufs:/dev/ufsid/011c86ed-6f2d-48a0-a132-f020c23a045c
   set FreeBSD.vfs.root.mountfrom.options=rw
}
Exit vi with :wq, update grub on disk:
sudo update-grub
Reboot your computer and you should be able to select FreeBSD in Grub now. Drop me a comment how it worked. Cheers!