howto backup partition with dd
Backing up the MBR:
dd if=/dev/hda of=backup-of-hda-mbr count=1 bs=512
This stores the first 512 bytes of the disk (contianing the MBR and the primary partition info - i.e. the first four primary entries) into the file bcakup-of-hda-mbr which you can then copy to somewhere safe.
To restore (be careful - this could destroy your existing partition table and with it access to all data on the disk):
dd if=backup-of-hda-mbr of=/dev/hda
If you only want to restore the actual MBR code and not the primary partition table entires, just restore the first 446 bytes:
dd of=/dev/hda if=backup-of-hda-mbr bs=446 count=1.
Those first 512 bytes are 446 bytes of MBR, then 64 bytes of primary partition table)
Backing up the extended partition table:
sfdisk -d /dev/hda > backup-hda.sfdisk
sfdisk is in the util-linux package. I think it's in Knoppix.
Restore (ditto the above warning):
sfdisk /dev/hda < backup-hda.sfdisk
