From http://raspberrypi.stackexchange.com/a/312
If you are running Linux then you can use the dd command to make a full backup of the image:
dd if=/dev/diskx of=/path/to/image
or for compression:
dd if=/dev/diskx | gzip > /path/to/image.gz
Where sdx is your SD card.
To restore the backup, you reverse the commands: