I'm too spoiled by Windows utilities that take a digital snapshot of your entire drive, which you can then restore from in the event of a drive crash. (e.g. like Time Machine for Mac OS X).
Is there a similar way of doing this in Linux?
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.
PartImage runs from the command line or as a text GUI. It has one important advantage over dd:
Several. There's the old fashioned dd(1), which is kind of arcane; there's dump(8) and restore(8); there are several open-source products around, like Amanda; and if you want, you can install ZFS and use a cron script to take periodic snapshots, giving you something effectively identical to Time Machine (see Tim Foster's weblog.)
Wikipedia has an article with a list of many options.
You can simply do "
Or, you could do "
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:
This was on a fast local network, of course. Otherwise it would have been more prudent to compress before transmission:
Hope you find some of this useful.
Edit: Oops. Changed
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.
I always worried about using dd when the drives were differently sized. Or had different numbers of heads/sectors/tracks/etc.
dd is very useful when snapshotting and reflashing the same drive. Especially USB drives or windows partitions. But when going from a 500Meg to a 1500Meg drive, I get concerned.
Besides, when my drive fails, I like to be able to use it as an excuse to upgrade to a newer OS.
All that said, good old tar does a nice job! GNU-tar includes diff-tar-against-files, only-update-files-that-have-changed, and only-archive-files-newer-than-date options.
(I should mention: I did run into a bug a few years back that required me to download and install a newer version of GNU-tar. (Something to do with very long pathnames and multiple volumes.) No big deal. Just be aware that's always an option.)
You should probably exclude /proc, /sys, and perhaps /var/log/lastlog or /mnt. (I usually back up to an external drive mounted under /mnt. Backing up the backup -- not so good!)
Including /dev can be worthwhile. gnu-tar will handle devices properly (mknod). Though you probably won't use the backed up /dev during a restore. (Occasionally its nice to see what permissions or links you had set up before.)
Also, you might want to dump fdisk & rpm info before backing up. E.g.
As well as mounting any "optional" user-mounted filesystems.
Here's the full steps for another method, works for moving from one hard drive to another, and even cloning a machine if the hardware is similar.
First, create an image of a good working system. Do this as root.
Backup the kernel images
Boot the machine you want the image deployed on with a live cd/gentoo cd. Mount that hard drive and partition it appropriately:
Copy over the hostname.tgz file onto this machine.
Extract it into the root of the new machine /mnt/new_root
Chroot into the new environment.
Verify /boot/grub/grub.conf and /etc/fstab
Setup grub on the hard drive:
Exit and umount drives, reboot the machine.
If you're wanting a full image backup and restore type solution, like norton ghost, then I've found CloneZilla to work quite well. I boot the live CD, and then use another machine as an SSH server to backup/restore the image(s) to/from.
(I even managed to get the live version working via PXE boot for an old tablet laptop I had with no CD drive and no booting of USB, but it was a lot of fiddling.)
And you can use it for windows machines too.