Thursday, February 01, 2007

Dual Boot FreeBSD 6.2 and Linux (CentOS 4.4)

I've been building some machines for testing various network foo, and found that this would a good opportunity to try FreeBSD again. I've been heavily into Linux lately, mainly due to job requirements, but I don't want my *BSD skills to horribly stagnate (shocking coming from a gov't employee, I know), and this seemed like a good time. Since I can't get completely away from Linux, I wanted this machine to be dual boot.

The first obstacle was installation. FreeBSD still uses, by default, an ncurses-based menu driven install, although I understand there is a GUI install system being developed. No problem, as I'm just as comfortable on the command line as I am with a graphical interface. Installing CentOS 4.4 has the option of a text menu install, but it defaults to a graphical install (my biggest annoyance with RH/Fedora/CentOS install (anaconda?) is that it picks the strangest hard disk layouts if you don't specify exactly what you want, and sometimes it even screws that up). The difference in install methods speaks to how Linux is trying to be everything to everybody, whereas FreeBSD is comfortable sticking to it's roots. Personally, I'm on the fence as to whether either camp has it "right." Both installs went smooth.

I installed FreeBSD first, giving it the first half of the hard drive (1 partition, with 5 slices within that partition), and CentOS the last half of the disk with 3 partitions. Given the maturity and open source nature of both of these operating systems, I was surprised that CentOS didn't recognize that FreeBSD was installed, and offer to add it to the GRUB boot menu like it would have done if it detected MS Windows something or other. Silly. Reminds me of Mom yelling at us as a kid, "Now children, stop fighting and play nice."

Anyway, the fix to that was (thankfully) fairly simple because GRUB is such a well designed boot loader. After installing CentOS, it left itself as the only option, so I boot into that, and edit /etc/grub.conf (symlink to /boot/grub/grub.conf), and add the following (YMMV, primarily with regard to partition numbers, etc.):

title FreeBSD 6.2
root (hd0,0,a)
kernel /boot/loader

and upon the next boot, FreeBSD 6.2 will be a boot option. Selecting it from the list allowed it to boot normally.


Labels: , ,


At 6:58 PM, Blogger reflections said...

I just stumbled across your post. I was planning to do something similar, but in a reverse fashion. I already have Linux (Debian) installed on /dev/sda{1,2,3}. I have /dev/hda{1,2,3,5} as my playground and was planning to install FreeBSD on /dev/hda1. How should I modify grub in that case? Is it safe at all, knowing that the MBR is on the first track on hda1?

At 3:10 PM, Blogger Richard H. Fifarek said...

So, if I understand the question correctly, you have:




and the BIOS reads the MBR off of /dev/hda? If that's the case, you can attack it a couple of ways:

First off, make BACKUPS! There, I said it.

1. Change the BIOS to boot off of /dev/sda, install a boot loader (using a boot CD, typically), and voila, anything that gets written to /dev/hda won't prevent your Debian install from booting.

2. As you alluded to, install on /dev/hda, taking care to preserve the MBR.

Either way, the Grub entry would be identical, because line:

root (hd0,0,a)

indicates to use the first hard drive (hd0), then the first partition on that hard drive (0), and then use the "a slice" on that partition (a).

Hope that helps.


At 4:11 PM, Blogger glad to be gone** said...

Just what I needed!

At 9:30 AM, Blogger unixbhaskar said...

I have just stumbled over your post and have some query as you know the topic already.

First : I want to install FreeBSD in my laptop,which already have the following:

/dev/sda1 ----> Gentoo
/dev/sda2 -----> swap
/dev/sda4 -----> extended
/dev/sda5 -----> CentOS

And I have around 15 Gb space left in extended partition and want to fill it with FreeBSD.

Plus Grub is loading from OpenSUSE,and I put the Gentoo and CentOS entry in the grub of it. Clear!! And of course I just don't want to disturb that.So to be precise I want to put another entry in that Grub of SUSE to boot FreeBSD from there like other OS.

Can you run me through steps what should I do to install FreeBSD in my laptop.the Entire procedure,not just the grub entry,please.

Any help would be greatly appreciated and would be thankful to you.

At 10:03 AM, Blogger pbsl said...

This comment has been removed by a blog administrator.


Post a Comment

Links to this post:

Create a Link

<< Home