How to backup an entire partition

The most straight forward way to make a raw image of your partitions is to use dd to dump the entire partition to a single file (remember the OS access the partitions /dev/sda1 through a file interface). Make sure you are on a larger partition or on a secondary drive and perform the following command
dd if=/dev/hda1 of=./part1.image to backup(repeat for different partitions)
dd if=./part1.image of=/dev/hda1 to restore

You can use the exact same command to backup the entire hard disk (replace hda1 with hda). You can then use any compression program (gunzip, zip, bzip) to compress the file for storage. You can use this same technique to make rote copies of entire partitions to make clones of your computer.

There is one limitation though, when restoring the backup, the partition needs to be the same size (or bigger) as the partition you took the image from, so this limits your options in case of a restore. However, you can always expand the partition after you’ve restored the backup using gparted or parted. The picture gets even muddier when you are trying to restore entire disk copies, however, if you are restoring the backup to the same exact hardrive you don’t need to worry about this at all.