How To Backup & Restore Master Boot Record (MBR) In Linux

by lifeLinux on August 22, 2011

A master boot record (MBR) is a type of boot sector popularized by the IBM Personal Computer. It consists of a sequence of 512 bytes located at the first sector of a data storage device such as a hard disk. MBRs are usually placed on storage devices intended for use with IBM PC-compatible systems.

MBR Total Size

446 + 64 + 2 = 512

Where,
446 bytes – Bootstrap.
64 bytes – Partition table.
2 bytes – Signature.

Backup MBR

Linux or Unix provides “dd” tool to backup any file. Usually, you must be “root” so that you can use it.

# dd if=/dev/sda of=/backup/mbr_sda.bak bs=512 count=1

Above command will copy 512 bytes (MBR) from sda to mbr_sda.bak

Restore MBR

To restore the MBR and partition table, type the following command

# dd if=/backup/mbr_sda.bak of=/dev/hda bs=512 count=1

To restore the MBR, type the following command

# dd if=/backup/mbr_sda.bak of=/dev/hda bs=446 count=1

Related Posts:

Previous post:

Next post: