Monday, August 13, 2007

Backup hard disk partition table

dd the old good command which now backup partition tables even writes CDs ;). Backing up partition is nothing but actually backing up MBR (master boot record). The command is as follows for backing up MBR stored on /dev/sdX or /dev/hdX :

# dd if=/dev/sdX of=/tmp/sda-mbr.bin bs=512 count=1

Replace X with actual device name such as /dev/sda.

Now to restore partition table to disk, all you need to do is use dd command:

# dd if= sda-mbr.bin of=/dev/sdX bs=1 count=64 skip=446 seek=446

dd command works with Solaris, HP-UX and all other UNIX like operating systems. Read man page of dd for more info.

No comments: