Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

At the moment, I have an Ubuntu 11.04 installation on a single 500GB hard drive in my laptop. The hard drive is partitioned into four parts: 500MB for the boot information, 2GB for the swap partition, 195GB for the home folder and the remainder of the space for the rest of the installation. The two latter partitions are extended partitions, and all partitions (except the swap) are ext4.

I want to format the hard drive in preparation for installing Arch Linux on this laptop. However, if things go wrong, or if I decide I don't want to use it any longer for whatever reason, I want to be able to restore my Ubuntu installation exactly as it was before I formatted the hard drive. This means I want something that's going to backup the MBR and the partition table.

Is using dd the best way to accomplish this? If so, is there anything I need to be wary of when using it to perform the operation (other than ensuring the filesystems are unmounted and that I don't confuse if and of)? Is there anything else I need to worry about? Is there anything I need to worry about when restoring the image?

If not, what is the best way of achieving this?

share|improve this question

closed as off topic by Sven, Chris S Nov 21 '12 at 14:22

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
dd is the right tool to use for the purpose. See: cyberciti.biz/faq/howto-copy-mbr –  val0x00ff Nov 21 '12 at 12:52
    
If I use dd to backup the entire hard drive, not just the first 512 bytes, I assume that will include the MBR. What about the partition table? Do I need to use sfdisk to do that, or will using dd to copy the entire disk do that for me? –  Matthew G Nov 21 '12 at 12:57
    
dd will clone the entire disk with the side-effect that you must use a disk at least as big as the original one to restore and will loose the additional space of a larger disk in the first step of a restore (can usually be corrected afterwards). –  Sven Nov 21 '12 at 13:05
    
So just to make sure it's explicit, using dd means I won't need to backup the partition table individually? –  Matthew G Nov 21 '12 at 13:27
    
If you clone the device (e.g. /dev/sda) you get the partition table in the clone. If you clone a partition (e.g. /dev/sda1, /dev/sda2) you must recreate them manually to restore. –  Chris Nava Nov 21 '12 at 14:19

1 Answer 1

The best way is to backup complete hard drive with its structure or a Complete clonign, use CloneZilla, which has a Live CD, and you can save complete image of your hard drive on a USB Hard drive. backup/restoration is brilliant in it. i had been using it for many years to backup and restore server.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.