- NetBSD Manual Pages
MBR(8) NetBSD/x86 System Manager's Manual MBR(8)
Powered by man-cgi (2020-09-24).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.
mbr, bootselect -- Master Boot Record bootcode
An IBM PC boots from a disk by loading its first sector and executing the
code in it. For a hard disk, this first sector usually contains a table
of partitions present on the disk. The first sector of a disk containing
such a table is called the Master Boot Record (MBR).
The code present in the MBR will typically examine the partition table,
find the partition that is marked active, and boot from it. Booting from
a partition simply means loading the first sector in that partition, and
executing the code in it, as is done for the MBR itself.
NetBSD supplies several versions of the MBR bootcode:
Normal boot code /usr/mdec/mbr
This version has the same functionality as that supplied by DOS/Win-
dows and other operating systems: it picks the active partition and
boots from it. Its advantage over other, older MBRs, is that it can
detect and use extensions to the BIOS interface that will allow it to
boot partitions that cross or start beyond the 8 Gigabyte boundary.
The bootselecting MBR contains configurable code that will present
the user with a simple menu, allowing a choice between partitions to
boot from, and hard disks to boot from. The choices and default set-
tings can be configured through fdisk(8).
Extended Bootselector /usr/mdec/mbr_ext
The extended bootselecting MBR additionally allows NetBSD to be
loaded from an Extended partition. It only supports systems whose
BIOS supports the extensions to boot partitions beyond the 8 Gigabyte
Serial Bootselector /usr/mdec/mbr_com0
This has the same features as mbr_ext but will read and write from
the first serial port. It assumes that the BIOS has initialized the
Serial Bootselector /usr/mdec/mbr_com0_9600
This has the same features as mbr_com0. Additionally, it initializes
the serial port to 9600 baud.
The rest of this manual page will discuss the bootselecting versions of
the MBR. The configurable items of the bootselector are:
timeout The number of seconds that the bootcode will wait for
the user to press a key, selecting a menu item. Must
be in the range 0-3600, or -1 when it will wait for-
default The default partition or disk to boot from, should the
The bootselector will output a menu of the bootmenu names for each parti-
tion (as configured by fdisk(8)). The user can then select the partition
or drive to boot from via the keyboard.
The numeric keys 1 upwards will initiate a startup from the corresponding
Function keys F1 through F8 (keys a through h for the serial versions)
will boot from hard disks 0 through 7 (BIOS numbers 0x80 through 0x87).
Booting from a drive is simply done by reading the MBR of that drive and
executing it, so the bootcode present in the MBR of the chosen drive
determines which partition (if any) will be booted in the end.
The Enter key will cause the bootcode to find the active partition, and
boot from it. If no key is pressed, the (configurable) default selection
The following error are detected:
Code Text message Explanation
1 No active partition The MBR has a partition table without an
2 Disk read error There was an error reading the bootsector
for the partition or drive selected.
3 No operating system The bootsector was loaded successfully,
but it was not valid (i.e., the magic num-
ber check failed, or it contained no
L Invalid CHS read The boot partition cannot be read using a
CHS read and the system BIOS doesn't sup-
port LBA reads.
? Unknown key.
The standard boot code will output the text message and stop. It may be
necessary to reset to the system to continue.
The bootselect code will output 'Error <code>' and await further input.
disklabel(8), fdisk(8), installboot(8), mbrlabel(8), x86/boot(8)
The bootselect code has constraints because of the limited amount of
space available. The only way to be absolutely sure that a bootselector
will always fit on the disk when a partition table is used, is to make it
small enough to fit into the first sector (512 bytes, 404 excluding the
partition table and bootselect menu).
The error messages are necessarily terse.
NetBSD 9.99 February 17, 2017 NetBSD 9.99