dual boot; Linux, FreeBSD

Jerry McAllister jerrymc at clunix.cl.msu.edu
Sun Jun 11 02:11:30 UTC 2006

> On Jun 10, 2006, at 8:00 AM, Jerry McAllister wrote:
> >>
> >> Hello;
> >> If I want to set up a dual boot of either Linux or FreeBSD, what is 
> >> the
> >> best way to go about it?
> >> Use Lilo, grub, or does FreeBSD have a boot loader that it likes 
> >> better
> >> and Linux won't object to?
> >
> > Mabye you are using the term 'boot loader' for what I am used to seeing
> > called the 'MBR'.   The boot loader I am familiar comes later in the
> > process and is unique to each OS.
> Thank you for correcting me on the terminology; and the info and advice.
> So MBR is Master Boot Record? I remember when installing FreeBSD and
> slicing and partitioning it asks if the slice should contain and MBR. I 
> assumed
> that that was the part of the os that was os specific because the file 
> systems
> are different, but I may have something to learn correctly. 
> Particularly the difference
> between slices and labeling/partitioning. But this confusion hasn't 
> prevented me from installing successfully.

OK.   Just a little more on MBR vs boot sector vs boot loader.

The slice doesn't contain the MBR.  That is in sector 0 of the disk device.
Then 'below' that, each slice contains a boot sector.   

In FreeBSd world, a slice is the primary division of the disk.  It is
generally referred to as a primary partition in Microsloth land.  But
that is the same.  Each slice (primary partition) can be bootable. 

To be bootable, a slice must be marked as bootable and have a boot
record in its first sector.  Note that this is not the first sector on
the disk device (eg sector 0) but the boot sector of the slice.   That 
boot record is unique to the particular OS living in that slice.

In FreeBSD (as with most UNIXen) each slice can be further divided
in to partitions.   In FreeBSD, the 'a' partition on the slice is
generally assumed to be the system partition and is called 'root' and
gets mounted as '/'.   

The sequence of events is essentially:
  The system starts up, find and runs the BIOS. 
  The BIOS does some hardware checks, including the boot order.
  A typical boot order can be:   floppy, CD, Hard disk.
  The BIOS searches through its boot device list for one that has an MBR
  The BIOS loads the first MBR it finds in its list and transfers control.
  The MBR looks at its slice table and offers a choice of those that 
      are marked as bootable and have a recognizable boot record in its 
      boot sector.  All MBRs have some way of choosing a slice to boot by 
      default if you don't make any other choice.  
  The MBR loads up that boot sector and transfers control to it.
  The boot sector code does some more checking and generally runs a boot
  loader that is able to read up some sort of script that tells what features
      you want to be part of the system.
  The boot record then finishes the boot and hands over control to the newly
  booted system, usually to a program called 'init' in UNIX world.
  Some more services might still be started after init begins to run.  In
      FreeBSD that is controlled by the rc.xxx scripts.   All that stuff that
  the boot loader looks at and the init program that is given control are
  normally somewhere in the root (/) partition, which is part of the slice
  being booted, which is a primary division of the disk device being booted.

So, in a sense, there is a hierarchy:  BIOS, disk device, slice then partition
Each has some part of the boot and tha is used in order.
If there are bootable slices on more than one disk device, then each disk
that has a bootable slice that you intend to use that way, must have an MBR.
Each bootable slice on each bootable disk must have a boot record in the
boot sector.  After that, it is up the the OS what comes next.
The BIOS only deals with the first device in its boot list that has a
proper MBR and hands control to it.   If there is more than one device
to choose from, that MBR has to figure it out and give you that choice.
Although it would be possible for that first MBR to read up all the 
slices that are marked as bootable on all disk devices and offer them
all as choices right off the bat.   But, at least the FreeBSD MBR starts
with the its own bootable slices and then just the other disks that
have MBRs   If you want one of the other disks, you first select that
disk (generally identified as choice 5 or F5) and then its MBR will 
put up its list of choices for you.   I haven't tried it with 3 disks
with bootable slices.  I guess it will just continue on.

Anyway, this all works just fine.  The MBR and initial boot record in
the boot sector of each slice (or primary partition if you must degrade
to MS terminology) have just enough standardization that the FreeBSD MBR
or most any of the other more fancy ones, can initiate the boot for any 
of the OS-en commonly available to run on these machines.   Since the OS
specific stuff really comes after it gets in to the slice boot record 
code in the boot sector, then generally any of them can boot any of them.
The exception is MS MBRs.  I have heard that some more recent ones play
better, but any I have had so far will not boot any slice except one
for a MS OS.   I don't know what they screw up, but find it not surprising.

So, there is the tome.
All newbies, careful what you ask.  Someone may answer thusly with more
than you every wanted to know.


> >
> > All of those you name will work as an MBR.
> > I just stick with the FreeBSD MBR but I don't have any need for fancy
> > features or display formatting that the others give you.
> > The FreeBSD MBR should be able to start any of them.  FreeBSD can be
> > started from any of those MBRs.   It is more an aesthetic thing.  
> > Advocates
> > of each tend to get rabidly partisan.  But, the really meaningful 
> > differences
> > are small.
> >
> > Past the MBR stage, use the boot sector and boot loader stuff that 
> > comes
> > with the OS you put on each bootable slice.
> >
> > One thing you need to do is put the MBR on each disk if you are putting
> > each OS on a separate disk.   The Bios will start the first one and
> > the MBR should then give you a choice of any bootable slices on the 
> > first
> > drive and also the choice of going to the second drive MBR.  If you
> > then chose the second MBR, that one will give you the choice of all
> > the bootable slices on that drive.   Probably you will make only one
> > bootable slice on each drive, but could make up to 4.
> >

More information about the freebsd-questions mailing list