In linux, how do I create/restore an image snapshot of my entire drive?
Solution 1:
The tool you want (which most closely resembles Time Machine) is called rsnapshot. Unlike normal backup tools it copies only things that have changed, and it allows you easily to travel to many points in time. You can tell it how much disk space it is allowed to have, and it adjusts the number of snapshots kept to stay within that limit. A very nice tool.
Solution 2:
You can simply do "dd if=/dev/sda of=/path/to/target/backup
" if you know you have the room where you are trying to put it. You could also do "dd if=/dev/sda | bzip2 > /path/to/target/backup
" to compress on-the-fly. This might take some time though.
Or, you could do "tar --preserve-permissions -cjf backup.tar.bz2 /what/to/backup
" as a user that has all the neccessary read permissions. Take your pick.
Addendum: I recently bought a new laptop, preinstalled with Vista. I figured I wanted to preserve vista somewhere, in case I wanted to try it out at some point, so the first time I booted the computer (with a linux livecd), I did this:
dd if=/dev/sda | ssh 10.0.0.1 "bzip2 > ~/vistadrive.bz2"
This was on a fast local network, of course. Otherwise it would have been more prudent to compress before transmission:
dd if=/dev/sda | bzip2 | ssh 10.0.0.1 "cat > ~/vistadrive.bz2"
Hope you find some of this useful.
Edit: Oops. Changed bb
to dd
...
Solution 3:
PartImage runs from the command line or as a text GUI. It has one important advantage over dd:
Partimage will only copy data from the used portions of the partition. For speed and efficiency, free blocks are not written to the image file. This is unlike the 'dd' command, which also copies empty blocks.
Solution 4:
I use a two-fold strategy: #1 is LVM snapshots and number two is rsnapshot, which I use to make point-in-time backups to a dedicated external hard disk drive. The external hard disk drive is placed so that I can easily yank it on my way out the door should something bad happen. I don't (yet) use an off-site mechanism other than periodically burning a snapshot to a series of encrypted DVD discs and shipping them to a friend's place in another city for storage.
I highly recommend rsnapshot because of the way it does the snapshots, using hard links for things that haven't changed. If your home directory goes bonkers, you can just take an rsnapshot copy and tarpipe or rsync it back to your new home partition after reinstalling or recovering from drive failure.