Server Administration & Management

Backup partition table and bootloader

We can backup the MBR record of a hard-drive. The MBR record contains the partition table and bootloader.

Having a backup of the MBR is important and useful in case, when you want to copy data from an older drive to a new one or in case you want to restore data from a damaged drive.

How to backup the MBR record

# dd if=/dev/sdX of=MBR.bck bs=512 count=1

Note : you have to replace /dev/sdX with your actual drive. This can be /dev/sda, /dev/hda, etc.

How to restore de MBR record

# dd if=MBR.bck of=/dev/sdX bs=512 count=1

Again you have to replace /dev/sdX with your actual drive. If you also want to keep a human readable copy of the partition table you can run:

# fdisk -l > part.table


January 24, 2011 Posted by | Tips & Tricks, Unix/Linux | , , | 2 Comments