Backing up and Restoring the Master Boot Record (MBR).

Making a copy or backup of your MBR is very simple. There’s a couple of ways you can go about it. First one, using “dd” command, and second, using “sfdisk.”

The Master Boot Record is 512 bytes

446 Bootstrap + 64 Partition Table + 2 Signature = 512

Using “dd” with identical partitions

copying  

dd if=/dev/sdb of=sdbmbr.bak bs=512 count=1

restoring

dd if=sdbmbr.bak of=/dev/sdb bs=512 count=1

Using “dd” with different partitions (when restoring to a different partition size will keep original size).

copying

dd if=/dev/sdb of=sdbmbr.bak bs=512 count=1

restoring

dd if=sdbmbr.bak of=/dev/sdb bs=446 count=1

Using “sfdisk” linux command

copying

sfdisk -d /dev/sdb > ~/sdbmbr.bak

restoring

sfdisk /dev/sdb < sdbmbr.bak
Share This!

Leave a Reply

Your email address will not be published.