MBR

From LQWiki
(Redirected from Mbr)
Jump to navigation Jump to search

MBR stands for Master Boot Record. It is located in the first sector of the first hard disk or a floppy disk. It contains a small program that is read into memory and executed at boot (after the BIOS bootup). The program tries to find a bootable partition in the partition table (which is located in the end of the MBR sector). The boot sector of the partition is then loaded and executed. This normally is some boot loader but can also be an actual kernel of some specific OS. In Linux LILO or GRUB is usually installed in the MBR.

In linux the MBR can be directly accessed with dd. For example to make a backup of the MBR:

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

and restore it with

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

Change hda to sda for SCSI or SATA drives.

Change to the a of hda to b or c etc for drives on other controllers.

See also