Backup Restore MBR And Partition Table Linux

1)Master Boot sector it is 512 bytes
2)Locate at the First Sector in Hard Disk or Storage Device
3)MBR Total Size 512 Bytes
Bootstrap = 446 bytes
Partition Table = 64 bytes
Signature = 2 bytes


Backup Only Master Boot Sector Not Partition Table
#dd if=/dev/sda of=/tmp/mbr.bak bs=512 count=1
Restore
#dd if=/tmp/mbr.bak of=/dev/sdb bs=446 count=1

Backup Only the Partition Not Master Boot Sectore MBR
#dd if=/dev/sda of=/tmp/part.bak bs=512 count=1
Restore
#dd if=/tmp/part.bak of=/dev/sdb bs=1 count=64 skip=446 seek=446

How to Create the Boot Load in MBR Refer the Link Restore Recreate Lost MBR Grub Boot Loader Linux

2 comments:

Kao Dome said...

Hello, thank you for this information.

So... backing up the partition table and MBR share the exact same command? The only difference is when restoring?

Say I want to restore a previous MBR and partition table the required command would be:

dd if=backup.bak of=/dev/sda ?

Learning|Tutorial said...

To Restore the MBR

#dd if=/tmp/part.bak of=/dev/sdb bs=1 count=64 skip=446 seek=446