2003-05-01 14:43:14 +04:00
|
|
|
.\" $NetBSD: mbr.8,v 1.10 2003/05/01 10:43:14 wiz Exp $
|
2003-05-01 12:40:17 +04:00
|
|
|
.Dd April 30, 2003
|
2002-07-10 02:11:50 +04:00
|
|
|
.Dt MBR 8
|
1999-04-16 02:35:19 +04:00
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm mbr ,
|
|
|
|
.Nm bootselect
|
2002-07-10 02:51:13 +04:00
|
|
|
.Nd Master Boot Record bootcode
|
1999-04-16 02:35:19 +04:00
|
|
|
.Sh DESCRIPTION
|
2002-07-10 02:51:13 +04:00
|
|
|
An IBM PC boots from a disk by loading its first sector and executing
|
|
|
|
the code in it.
|
2002-01-13 11:02:14 +03:00
|
|
|
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).
|
|
|
|
.Pp
|
|
|
|
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.
|
1999-04-16 02:35:19 +04:00
|
|
|
.Pp
|
2001-11-16 14:36:09 +03:00
|
|
|
.Nx
|
2003-05-01 12:40:17 +04:00
|
|
|
supplies three versions of the MBR bootcode:
|
1999-04-16 02:35:19 +04:00
|
|
|
.Bl -tag -width Er
|
|
|
|
.It Sy Normal boot code
|
|
|
|
This version has the same functionality as that supplied by DOS/Windows 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.
|
|
|
|
.It Sy Bootselector
|
|
|
|
The bootselecting MBR contains configurable code that will present
|
|
|
|
the user with a simple menu, allowing a choice between partitions to
|
2002-01-13 11:02:14 +03:00
|
|
|
boot from, and hard disks to boot from.
|
|
|
|
The choices and default settings can be configured through
|
2000-11-07 08:40:17 +03:00
|
|
|
.Xr fdisk 8 .
|
2003-05-01 12:40:17 +04:00
|
|
|
.It Sy Extended Bootselector
|
|
|
|
The Extended Bootselecting MBR additionally allows
|
|
|
|
.Nx
|
|
|
|
to be loaded from an Extended partition.
|
|
|
|
It only supports systems whose BIOS supports the extensions to
|
|
|
|
boot partitions beyond the 8 Gigabyte boundary.
|
1999-04-16 02:35:19 +04:00
|
|
|
.El
|
|
|
|
.Pp
|
2003-05-01 12:40:17 +04:00
|
|
|
The rest of this manual page will discuss the bootselecting versions of
|
2002-01-13 11:02:14 +03:00
|
|
|
the MBR.
|
|
|
|
The configurable items of the bootselector are:
|
1999-04-16 02:35:19 +04:00
|
|
|
.Bl -tag -width Er
|
|
|
|
.It timeout
|
|
|
|
The number of seconds that the bootcode will wait for the user to
|
2002-01-13 11:02:14 +03:00
|
|
|
press a key, selecting a menu item.
|
2003-05-01 14:43:14 +04:00
|
|
|
Must be in the range 0-3600, or \-1 when it will wait forever.
|
1999-04-16 02:35:19 +04:00
|
|
|
.It default
|
|
|
|
The default partition or disk to boot from, should the timeout
|
|
|
|
expire.
|
|
|
|
.El
|
|
|
|
.Pp
|
2003-05-01 12:40:17 +04:00
|
|
|
The bootselector will output a menu of the
|
|
|
|
.Em bootmenu
|
|
|
|
names for each partition (as configured by
|
2003-05-01 14:43:14 +04:00
|
|
|
.Xr fdisk 8 ) .
|
2003-05-01 12:40:17 +04:00
|
|
|
The user can then select the partition
|
2002-01-13 11:02:14 +03:00
|
|
|
or drive to boot from via the keyboard.
|
|
|
|
.Pp
|
2003-05-01 12:40:17 +04:00
|
|
|
The numeric keys
|
|
|
|
.Sy 1
|
|
|
|
upwards will initiate a startup from the corresponding partition.
|
1999-04-16 02:35:19 +04:00
|
|
|
.Pp
|
2002-01-13 11:02:14 +03:00
|
|
|
Function keys
|
2003-05-01 12:40:17 +04:00
|
|
|
.Sy F1
|
2002-01-13 11:02:14 +03:00
|
|
|
through
|
2003-05-01 12:40:17 +04:00
|
|
|
.Sy F8
|
|
|
|
will boot from harddisks 0 through 7 (BIOS numbers 0x80 through 0x87).
|
2002-01-13 11:02:14 +03:00
|
|
|
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.
|
1999-04-16 02:35:19 +04:00
|
|
|
.Pp
|
2002-01-13 11:02:14 +03:00
|
|
|
The
|
|
|
|
.Sy Enter
|
|
|
|
key will cause the bootcode to find the active partition, and boot from it.
|
|
|
|
If no key is pressed, the (configurable) default selection is picked.
|
2001-11-16 14:36:09 +03:00
|
|
|
.Sh DIAGNOSTICS
|
2003-05-01 12:40:17 +04:00
|
|
|
The following error are detected:
|
2003-05-01 14:43:14 +04:00
|
|
|
.Bl -column Code "No active partition"
|
2003-05-01 12:40:17 +04:00
|
|
|
.It Em Code Ta Em "Text message" Ta Em Explanation
|
|
|
|
.It 1 Ta "No active partition" Ta
|
2002-01-13 11:02:14 +03:00
|
|
|
The MBR has a partition table without an active partition.
|
2003-05-01 12:40:17 +04:00
|
|
|
.It 2 Ta "Disk read error" Ta
|
2002-01-13 11:02:14 +03:00
|
|
|
There was an error reading the bootsector for the partition or
|
|
|
|
drive selected.
|
2003-05-01 12:40:17 +04:00
|
|
|
.It 3 Ta "No operating system" Ta
|
2003-05-01 14:43:14 +04:00
|
|
|
The bootsector was loaded successfully, but it was not valid (i.e.,
|
2003-05-01 12:40:17 +04:00
|
|
|
the magic number check failed, or it contained no code).
|
|
|
|
.It L Ta "Invalid CHS read" Ta
|
|
|
|
The boot partition cannot be read using a CHS read and the system BIOS
|
|
|
|
doesn't support LBA reads.
|
|
|
|
.It ? Ta "" Ta
|
|
|
|
Unknown key.
|
1999-04-16 02:35:19 +04:00
|
|
|
.El
|
2003-05-01 12:40:17 +04:00
|
|
|
.Pp
|
|
|
|
The standard boot code will output the text message and stop.
|
|
|
|
It may be necessary to reset to the system to continue.
|
|
|
|
.Pp
|
2003-05-01 14:43:14 +04:00
|
|
|
The bootselect code will output 'Error \*[Lt]code\*[Gt]' and await further input.
|
1999-04-16 02:35:19 +04:00
|
|
|
.Sh SEE ALSO
|
2003-05-01 12:40:17 +04:00
|
|
|
.Xr boot 8 ,
|
|
|
|
.Xr disklabel 8 ,
|
2003-05-01 14:43:14 +04:00
|
|
|
.Xr fdisk 8 ,
|
2003-05-01 12:40:17 +04:00
|
|
|
.Xr installboot 8 ,
|
2002-01-13 11:02:14 +03:00
|
|
|
.Xr mbrlabel 8
|
1999-04-16 02:35:19 +04:00
|
|
|
.Sh BUGS
|
|
|
|
The bootselect code has constraints because of the limited amount of
|
2002-01-13 11:02:14 +03:00
|
|
|
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
|
2003-05-01 12:40:17 +04:00
|
|
|
enough to fit into the first sector (512 bytes, 404 excluding
|
|
|
|
the partition table and bootselect menu).
|
2002-01-13 11:02:14 +03:00
|
|
|
.Pp
|
2003-05-01 12:40:17 +04:00
|
|
|
The error messages are necessarily terse.
|