Linux Backup MBR – Master Boot Record

Backup and Restore Hard drive partitions and MBR.

This does the partition map only, not the actual partition data. To do entire drives or partitions use dd to backup and restore entire hard drives or clone drive.

* To backup use:
sudo dd if=/dev/hda of=mbr.backup bs=512 count=1
* To restore use:
sudo dd of=/dev/hda if=mbr.backup bs=512 count=1

Caution the MBR contains the partition table (the first four primary entries) it will break things if you changed the partition since the backup.

If you do not want to restore the partition table you should use sudo dd of=/dev/hda if=mbr.backup bs=446 count=1 instead. This will write only the first 446 bytes of the MBR leaving the last 64 bytes intact (4 partition table entries * 16 bytes/entry). You can restore an MBR even from a backup that has all 512 bytes just by specifying 446 on the restore operation!

Be warned that you may not be able to boot from this disk if you changed the partition table after the backup of the MBR, depending on the actual boot loader .

Click here If you want to linux disk backup dd.

Leave a comment