dd your mbr

Sorry, if you don’t know what dd or mbr are, you need to do some more reading up first 😉

 

Some self-explanatory code snippets seen elsewhere as a good reminder for old-style partition tables:

# To save the MBR to a file (contains the partition table also):
dd if=/dev/sdX of=sdX-mbr-full bs=512 count=1

# To save the MBR without the partition table to a file:
dd if=/dev/sdX of=sdX-mbr-nopart bs=446 count=1

# To restore the MBR only:
dd if=sdX-mbr-nopart of=/dev/sdX

# To restore the MBR and partition table:
dd if=sdX-mbr-full of=/dev/sdX count=1 bs=446

Note that the above does NOT work for the newer “GPT” partition table.

Leave a Reply