Master Boot Record

From ParabolaWiki
(Redirected from MBR)
Jump to: navigation, search
Summary
An overview of the Master Boot Record; the first sector of a partitioned data storage device.
Overview
In order to boot Parabola, a Linux-capable boot loader such as GRUB, GRUB2, LILO, or Syslinux must be installed to the Master Boot Record, or the GUID Partition Table. The boot loader is responsible for loading the kernel and initial ramdisk before initiating the boot process.
Related
GUID Partition Table
Unified Extensible Firmware Interface
Parabola Boot Process

The Master Boot Record (MBR) is the first 512 bytes of a storage device. The MBR is not a partition; it is reserved for the operating system's bootloader and the storage device's partition table. The MBR may eventually be replaced by the GUID Partition Table, which is part of the Unified Extensible Firmware Interface specification.

1 Boot process

Booting is a multi-stage process. Most PCs today initialize system devices with firmware called the BIOS (Basic Input/Output System), which is typically stored in a dedicated ROM chip on the system board. After system devices have been initialized, the BIOS looks for the bootloader on the MBR of the first recognized storage device (hard disk drive, solid state drive, CD/DVD drive, USB drive...) or the first partition of the device. It then executes that program. The bootloader reads the partition table, and is then capable of loading the operating system(s). Common GNU/Linux bootloaders include GRUB and LILO.

2 History

The MBR consists of a short piece of assembly code (the initial bootloader – 446 bytes), a partition table for the 4 primary partitions (16 bytes each) and a sentinel (0xAA55).

The "Conventional" Windows/DOS MBR bootloader code will check the partition table for one and only one active partition, read X sectors from this partition and then transfer control to the operating system. The Windows/DOS bootloader can not boot an Parabola partition because it is not designed to load the Linux kernel, and it can only cater for an active, primary partition (which GRUB safely ignores).

The GRand Unified Bootloader (GRUB) is the de facto standard bootloader for GNU/Linux, and users are recommended to install it on the MBR to allow booting from any partition, whether it be primary or logical.

3 Backup and restoration

Because the MBR is located on the disk it can be backed up and later recovered.

To backup the MBR:

dd if=/dev/hda of=/path/mbr-backup bs=512 count=1

Restore the MBR:

dd if=/path/mbr-backup of=/dev/hda bs=512 count=1
Warning: Restoring the MBR with a mismatching partition table will make your data unreadable and nearly impossible to recover. If you simply need to reinstall the bootloader see GRUB or LILO.

To erase the MBR (may be useful if you have to do a full reinstall of another operating system) only the first 446 bits are zeroed because the rest of the data contains the partition table:

dd if=/dev/zero of=/dev/hda bs=446 count=1

4 See also

5 Acknowledgement

This wiki article is based on ArchWiki. We may have removed non-FSDG bits from it.