Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Dec 2012 17:11:44 -0500
From:      "Dieter BSD" <dieterbsd@engineer.com>
To:        freebsd-hackers@freebsd.org
Subject:   NetBSD's boot select MBR
Message-ID:  <20121213221145.310760@gmx.com>

next in thread | raw e-mail | index | archive | help
[ from the FreeBSD for serious performance? thread ]

> > So I use NetBSD's MBR for disks I want
> > to boot from.
>
> Can I have a CMD sequence?
>
> First would be ...
> # fetch ...

Read NetBSD's fdisk(8) and mbr(8).

The MBR is only 512 bytes, and must contain the code and data.
This is very limiting, so there are multiple versions depending
on which features you need. IIRC, /usr/mdec/mbr_bootsel is the one I use.
You can specify a label (up to 7 characters) for each bootable partition
("slice" in FreeBSD-speak). When the system executes the MBR code,
it presents a menu with these labels. You can type '1' for the first
partition/slice, '2' for the second, and so on. You can also type a
function key to run the MBR of a different disk. The disk numbering
can be rather insane, so it must be using the bios disk numbering. If
you don't type anything it times out and boots the active partition/slice.

Sadly, the FreeBSD bootstrap insists on booting the partition/slice
marked active in the MBR. (The MBR code should look at the active
bit, the later bootstraps should not.) So if you want to have
multiple FreeBSD versions, it works best to put each on its own disk.

The last time I used fdisk, large disks triggered a bug where some
variable overflowed, giving negative numbers. Hopefully this is fixed
by now. FreeBSD's fdisk also had some bug, so I had great fun
handcrafting a MBR.

It's been a long time since I installed NetBSD from scratch, (I usually
just unpack the tar files, run installboot, and edit some config files.)
I assume you can just boot a CD and get a shell, and experiment with
fdisk on a scratch disk without actually installing NetBSD.
To avoid a disaster, do something like
dd if=$DISK of=/boot/MBR_backup bs=512 count=1 ; sync
beforehand, in case you accidently mess up your boot drive.

man pages:
http://netbsd.gw.com/cgi-bin/man-cgi?++NetBSD-current

isos:
http://www.netbsd.org/mirrors/
for example:
ftp://iso.netbsd.org/pub/NetBSD/iso/5.2/amd64cd-5.2.iso
or
ftp://iso.netbsd.org/pub/NetBSD/iso/5.2/i386cd-5.2.iso



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