Backup a partition

This will backup a complete partition in an image-file. The second line overwrites the partition with data from the image-file.
Backup: dd if=/dev/hdaX | bzip2 -c9 >image.bz2
Restore: bzip2 -d image.bz2 | dd of=/dev/hdaX