12.28
Backup MBR on your Linux server(s)
It’s always useful to backup your hard disk partition table(s).
You can use DD to back-up and restore your partition table using the following commands:
# dd if=/dev/sda of=/tmp/sda-mbr.bin bs=512 count=1
(using your own device names ofcourse. In this example I used my /dev/sda HDD and /tmp/sda-mbr.bin as the output file).
DD will copy the first 512 bytes of the specified HDD (specified after “if=/” also known as the input for DD). As you know the first 512 bytes of a HDD is known as the MBR.
You can also use DD to restore the partition table to your disk. Just use the following command:
# dd if= sda-mbr.bin of=/dev/sda bs=1 count=64 skip=446 seek=446
(Again I used sda-mbr.bin as the file containing the MBR backup and /dev/sda as the HDD I want to restore).
DD can be used for many more useful things. Check the DD man pages for more info!
No Comment.
Add Your Comment