Every now and then I have to reinstall a system from scratch, putting the contents on the side. Before I used to go through the system and decide what to manually copy. Nowadays it's so much easier and relatively cheap to copy the whole thing.
In order to copy the partition /dev/sda1 to an image file:
sudo dd if=/dev/sda1 of=image-file.ddimg bs=4M
(The bs size depends on the hardware)
This will probably work gzipping the image on the fly:
sudo dd if=/dev/sda1 bs=4M | gzip -c > image-file.ddimg.gz