This depends a bit on your setup, and how exact you need to be about it. One way which will work would be to boot off a USB pen, and then do a backup of the block device (normally, but not always /dev/sda).
There are a few ways to do this. If this is a "one off", The simplest way is:
- In your Linux install, dd if=/dev/zero of=/tmp/del.me (This will
take a LONG time as its creating a large file with zeros). The system
will eventually run out of space and die with an error. THIS IS GOOD !!
- rm /tmp/del.me
- Reboot with Linux based USB system. Plug in your backup disk.
- If your data is on /dev/sdaX, and your backup disk is mounted as /mnt
execute the command cat /dev/sda | gzip -c /mnt/backup_disk/initial-ubuntu-install.gz to create an image. Once this is eventually done, unmount the backup disk and you have an image called initial-ubuntu-install.gz.
To recover from this backup later on, boot from a USB disk and execute the command zcat /mnt/backup_disk/initial-ubuntu-install.gz > /dev/sda
Steps 1 and 2 above zero out the unused disk to make it more compressable. They are optional, but will probably result in a way smaller compressed backup image.
Step 4 creates a compressed backup image. It is crude and does not give any indications of progress, but it uses standard tools which come with only a regular install. If your USB has pv (or you apt-get install pv) you can replace the command with pv /dev/sda | gzip -c /mnt/backup_disk/initial-ubuntu-install.gz to give you an indication of progress, similarly for decompressing you can use zcat /mnt/backup_disk/initial-ubuntu-install.gz | pv > /dev/sda
There are other, more complex ways of doing this excercise depending on if it needs to include everything, or just most stuff, but these techniques are more advanced.
I will confirm that Linux does have the idea of snapshots using "Logical Volume Management", and its not uncommon (but not required) for the root partition to be installed on a logical volume. IF you have Logical volumes installed you can take snapshots and back those up - BUT THERE IS A CATCH. Ubuntu can't boot off a Logical Volume, so it needs a small additional partition (typically mounted as /boot) to boot. In order to make this work you would need to -
- Take a dump of the disk geometry.
- Back up the /boot partition.
- Create a snapshot and then back it up.
- Destroy the snapshots.
[ Linux snapshots create a temporary copy of the exact state of a partition, they do not create an image for backing up - rather you need to take the snapshot and back it up as you would a partition - the only difference is that you can operate on a live OS, rather then booting to a USB key.