Title: Save MBR
Author: Sandro Tosi
Last modified: 2007-03-02 (2006-06-11)
To extract MBR use this command:
# dd if=/dev/hda of=mbr.bin bs=512 count=1
To see its contents, use this command:
# 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.
To restore MBR execute:
# dd if=mbr.bin of=/dev/hda bs=512 count=1
If you need to backup even information about logical partitions (a
partition inside a physical partition) you can execute this command:
# sfdisk -s /dev/hda > hda.sfd
and to restore those info:
# sfdisk -0 changelog.sfd /dev/hda < hda.sfd |