FreeBSD MBRs

Jerry McAllister jerrymc at msu.edu
Thu Aug 23 19:06:28 PDT 2007


On Thu, Aug 23, 2007 at 11:33:02AM +0100, Christopher Key wrote:

> Alex Zbyslaw wrote:
> >Jerry McAllister wrote:
> >
> >>You only need an MBR on disks that will be booted.  I don't know as
> >>it will actually hurt anything to write an MBR on non-boot, data only
> >>disks, but it can garbage up you menu with non-functional choices.
> >> 
> >>
> >What you need is an MBR on every disk which is *passed through* or 
> >actually booted from.  So if you have disks 1, 2 &3, if you want to 
> >boot from disk3 you need an MBR on disks 1 & 2 as well, even if you 
> >never boot from them.  If you boot from disk 1, then 2 &3 do not 
> >*need* an MBR.
> >
> >>Those other disk with an MBR show up as an F5 and maybe F6, etc (
> >>
> >F5 is the *next* disk.  There is no F6, F7 etc.
> >
> >If you boot from disk 3, for example, you'd go through three "menus" e.g.
> >
> >Disk1: F5 -> disk2
> >Disk2: F5 -> disk3
> >Disk3: F1 -> boots FreeBSD
> >
> >
> Thanks Jerry, Lowell and Alex,
> 
> That clarifies a few points.  Sorry the original post wasn't clear, I'll 
> have a go at rexpressing my original questions using the above for context.
> 
> Firstly, when you hit F5, does it, a) Load the partition table from the 
> next disk and update the displayed list of slices, or b) Execute the MBR 
> from the next disk?  I'll assume the latter.

The latter is the next step if you hit F5 (which can cause an updated
menu to be displayed based newly current configuration of the information 
on that next disk).

> Secondly, does boot0 'remember' that you pressed F5, and hence do the
> same the next time you boot, even after a power cycle?  In this case,
> having done,

It remembers, if and only if you don't hit anything during boot time.
If you hit something - like F1, that becomes the choice that it works on
regardless of what was hit in any previous boot.

> 
> Disk1: F5 -> disk2
> Disk2: F5 -> disk3
> Disk3: F1 -> boots FreeBSD
> 
> the next time, it will appear as,
> 
> Disk3: F1 -> boots FreeBSD
> 
> The behaviour that I was experiencing was as follows:
> 
> Disk1: F1 -> boots FresBSD
> 
> reboot
> 
> Disk1: F5 -> disk2
> Disk2: Has /boot/mbr on it, and hence attempts to boot the active 
> slice.  As there is no active slice on the disk, simply fails with the 
> message 'Missing operating system'
> 
> Now, subsequent attempts to boot simply display the message 'Missing 
> operating system'.  Hence, I concluded that either, a) boot0 was 
> rembering the F5 keystroke, and passing me on to disk 2 automatically, 
> or b) That the BIOS was rememering something and booting straight from 
> disk2 despite the boot order having disk1 first.

This is the behavior I would expect, but seems somewhat to contradict
Alex's response.   The first part seems correct that it cycles around
through disks in boot order, but he said that you should see another F5
choice instead of a missing OS error.    I have not had a string of disks 
more than two bootable disks and those being disk 0 and disk 1, so I can't 
be sure and would be inclined to accept Alex's response.  But, then it should
not have a problem with that disk 2, so without a chance to experiment, I
don't know how else to respond.   

I think the next experiment I would be inclined to try, at least if there
was nothing on that second disk (actually called disk 1 as in 0..n disks)
that I needed, I would overwrite that MBR with zeros (from /dev/zero, so
it has no MBR and no other boot type info and then slice and partition it
and see what happens.   You could just overwrite the MBR with dd and it
shouldn't affext the rest of the disk, but that would make me really 
nervous if I had anything valuable on it.  But if you are unconcerned, try
  dd if=/dev/zero of=/dev/ad1 bs=512 count=1 
ad1 being the second disk   or  da1 if it is SCSI of SAS
That should wipe the MBR on it.

Then, the previous MBR might not try to look at that second disk, or if
Alex is completely correct, then it will and not find it and get another 
error.

So, experiment.

////jerry



> 
> The only was that I found to rectify this was use a boot from a USB 
> device with boot0 on it:
> 
> USB: F5 -> disk1
> Disk1: F1 -> boots FreeBSD
> 
> And now, subsequent reboots work fine:
> 
> Disk1: F1 -> boots FresBSD
> 
> 
> I hope the above is a little more clear now.
> 
> Regards,
> 
> Chris
> 


More information about the freebsd-questions mailing list