Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Jul 2009 17:52:30 -0700
From:      Nerius Landys <nlandys@gmail.com>
To:        Daniel Underwood <djuatdelta@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: boot0 / LILO / GRUB: dual boot FreeBSD and Linux
Message-ID:  <560f92640907011752h784aab0l2e02c3c28b458685@mail.gmail.com>
In-Reply-To: <b6c05a470907011723k5d890d7cida1f3bc3447d8b1a@mail.gmail.com>
References:  <b6c05a470907011723k5d890d7cida1f3bc3447d8b1a@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> I'm getting a new desktop through my university which will come
> installed with Windows Vista.  Obviously, my first action item will be
> removing Vista and installing a reasonable OS.  Due to the need to be
> up-and-running immediately with an OS that I'm comfortable with, I'll
> be installing Linux (probably Ubuntu).  But I'd like to set-up FreeBSD
> also.
>
> Which of the boot managers do you suggest I use?  Which OS should I
> install first?  Since I've never set-up a FreeBSD/Linux dual-boot
> system, I don't know what, if any, pitfalls to avoid.  I'm hoping some
> of you will have experience I can learn from.  Any relevant advice
> would be greatly appreciated.
>

Hi, I'm primarily an Ubuntu Linux user, but I've experimented with
FreeBSD desktops and servers quite a bit (servers especially).  One
thing I found to be really cool is the FreeBSD boot manager.  I would
strongly recommend using the FreeBSD boot manager because it's
completely standalone; it does not depend on any files or data sitting
in your partitions.  The boot manager sits within the first 512 bytes
of your hard drive (the MBR) and it does not need any other data to
function.  The way it works is simple.  Well first a disclaimer.  What
I describe here, I'm pretty confident that I know what I'm talking
about, but there is a chance that my knowledge is wrong.  In that case
please correct me, someone.

The FreeBSD boot manager (I don't know the official name for it off
the top of my head), when run, looks at the partitions on the hard
drive.  It then presents a menu, where you press a function key to
select which partition to boot.  It basically delegates the booting to
the boot record on the partition of your choice.

The way to set this up is as follows.  Well, I'm sure it's possible to
install FreeBSD first and then Linux, but I will describe it the other
way.

First install Linux normally (well leaving space on your hard drive
for a FreeBSD partition, which needs to be primary and not extended).
After you install Linux, boot up and do some magic where you install
the boot manager (such as Grub or Lilo) onto the boot record of the
Linux parttion.  Normally the boot manager for Linux will be installed
in the MBR, but put it on the partition's boot sector as well.

Now install FreeBSD.  Install the FreeBSD boot manager.  It will not
touch the Linux partition at all, the FreeBSD install will only write
to the FreeBSD partition and to the MBR.

I would not recommend using Grub as a boot manager (for the MBR)
because it depends on files sitting on your Linux partition as far as
I know.  So when you wipe your Linux partition for some reason you
won't be able to boot any more.  Same goes for Lilo I think.  The
FreeBSD boot manager does not depend on any data outside of the MBR,
so it will continue working properly after you wipe a partition clean.

See here: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/boot-blocks.html
It appears that the boot manager is called boot0.

If you ever want to back up your MBR for some reason, which includes
the partition table and the boot program, you can do something like
this:

dd if=/dev/hda of=my-mbr-saved-file bs=512 count=1

where "/dev/hda" would be changed depending on OS and hard disk
configuration.  Then you can restore the MBR:

dd if=my-mbr-saved-file of=/dev/hda bs=512 count=1

But restoring should be done with extreme caution because it will
rewrite your partition table and could lead to lost data because of
that.

I have installed the FreeBSD boot manager by using dd after combining
the 446-byte long program with an existing partition table



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?560f92640907011752h784aab0l2e02c3c28b458685>