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?
ddwill 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). – SvW Nov 21 '12 at 13:05