Difference between revisions of "Master Boot Record"

From ArchWiki
Jump to: navigation, search
(Better clarification of how the program on the MBR is launched)
(grammar)
Line 1: Line 1:
Most PCs today use firmware called the [http://en.wikipedia.org/wiki/BIOS BIOS].  The BIOS is run when the computer first starts up where it initializes system devices.  After system devices have been initialized the BIOS then launches a program on the Master Boot Record (MBR).  The MBR is the first sector (first 512 bytes) of a storage device (hard disk, CD/DVD drive, USB drive...).  The BIOS launches the program on the MBR of the first recognized BIOS boot device on your computer.  The program (also known as a bootloader) reads the partition table also on the MBR and is then able to boot the operating system(s).  Common bootloaders in Linux are [[GRUB]] and [[LILO]].
+
Most PCs today use firmware called the [http://en.wikipedia.org/wiki/BIOS BIOS] (Basic Input/Output System).  The BIOS is typically contained within a CMOS (Ceramic Metal Oxide Semiconductor) and executes upon system power-up, when it then initializes system devices.  After system devices have been initialized, the BIOS then launches a program on the Master Boot Record (MBR).  The MBR is the first sector (first 512 bytes) of a storage device (hard disk drive, solid state drive, CD/DVD drive, USB drive...).  The BIOS launches the program on the MBR of the first recognized BIOS boot device on your computer.  This program (also known as a bootloader) reads the partition table (also contained within the MBR) and eventually boots the operating system(s).  Common GNU/Linux bootloaders include [[GRUB]] and [[LILO]].
  
== Saving/Restoring ==
+
== Backup and Restoration ==
  
{{Warning|This information is intended only if you really know what you are doing.  Saving then Restoring the MBR with a mismatching partition table will make you data unreadable and nearly impossible to recover. If you only want reinstall the bootloader see [[GRUB]] or [[LILO]].}}
+
{{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]].}}
  
Because the MBR is located physically on the disk can be saved and later recovered.
+
Because the MBR is located on the disk it can be backed up and later recovered.
  
To save the MBR:
+
To backup the MBR:
  
 
  dd if=/dev/hda of=/path/mbr-backup bs=512 count=1
 
  dd if=/dev/hda of=/path/mbr-backup bs=512 count=1

Revision as of 14:49, 21 November 2009

Most PCs today use firmware called the BIOS (Basic Input/Output System). The BIOS is typically contained within a CMOS (Ceramic Metal Oxide Semiconductor) and executes upon system power-up, when it then initializes system devices. After system devices have been initialized, the BIOS then launches a program on the Master Boot Record (MBR). The MBR is the first sector (first 512 bytes) of a storage device (hard disk drive, solid state drive, CD/DVD drive, USB drive...). The BIOS launches the program on the MBR of the first recognized BIOS boot device on your computer. This program (also known as a bootloader) reads the partition table (also contained within the MBR) and eventually boots the operating system(s). Common GNU/Linux bootloaders include GRUB and LILO.

Backup and Restoration

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.

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

To erase the MBR (may be useful if you have to do a full reinstall of another operating system):

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

Resources