Archive for the tag 'MBR'

How to Backup MBR - Master Boot Record

The MBR (master boot record) is located at cylinder 0, head 0, sector 1. It’s the very first sector of the hard drive and it is 512 bytes in size. When the BIOS boots your machine it looks in the MBR for information on your partitions and the initial boot loader. The MBR contains a partition table and boot code. The boot code executes and then transfers the process to the bootloader program on your active(bootable) partition.

We can take the backup of MBR either to a floppy disk or to a CDROM.

1. Backup to a floppy:

dd if=/dev/hda of=/dev/fd0 bs=512 count=1

2. Backup to CDR:

First, create the MBR backup to a file on your hard drive.

dd if=/dev/hda of=mbr.bak bs=512 count=1

Now, burn the file you just created to CDR.

SBDavid

Extracting the MBR

Extracting the MBR

To see the contents of your MBR, use this command:

# dd if=/dev/hda of=mbr.bin bs=512 count=1
# od -xa mbr.bin

The dd command, which needs to be run from root, reads the first 512 bytes from /dev/hda (the first Integrated Drive Electronics, or IDE drive) and writes them to the mbr.bin file. The od command prints the binary file in hex and ASCII formats.