Backing up my linux *installation;* everything but my /home partition
June 21, 2015 2:55 PM   Subscribe

I want to back up my Linux installation---everything EXCEPT my /home partition. Soup to nuts, what's my process? I am running the final release of Crunchbang, a Debian-based distro.

I have a backup solution for my data. It backs up to the cloud and to a local hard drive with CrashPlan. However, I want a back up solution for everything else---the OS, the updates, the programs.

Not all my programs come from the official repos---some are clones from Github, some were downloaded from tarballs, etc. It's a real pain getting everything back up and running.

The ideal solution would be something where, after booting from a thumb-drive live disk, I could image my hard-drive back to the latest image.

Imaging the *entire* laptop hard drive wouldn't allow me to take many snapshots, because I have only so much space for backups, my /home data changes all the time, etc. etc. Besides that, I would be double-saving all the stuff CrashPlan is already taking care of.

I am not afraid of the command line, I'm just not great at it. All the little snares that I don't know that I don't know is the main problem. It's just that I've messed up my install one too many times and this is no longer a topic I'm content to flail at. Usually I enjoy learning command-line stuff but I don't want to fart around for hours any more just to have my computer back to the way I want it after sys-admining while drunk.

I'm thinking the "dd" utility is my best bet, or maybe rsync, but I'm not sure how to exclude my home partition. I have read the f*cking manual and I'm still not confident I'm on the correct track. I've Duck Duck Go'd a number of search terms and am still not seeing anything that sounds precisely what I need. Maybe "snapshot?" "Image?" "ISO?" Not sure.

The ideal answer would tell me everything I have to type into my command line so I have a back up that can be used to re-image my laptop and have everything but my /home partition exactly the way it was. So, a guide that starts with going into single-user mode (whatever that is), to unmounting /home, to backing up and copying to the external (which I do happen to know how to mount), to making it a cron job.
posted by wires to Computers & Internet (5 answers total) 1 user marked this as a favorite
 
rsnapshot is your go-to tool for incremental Linux backups. You can just add /home to the #exclude options in the config file.
posted by nicwolff at 3:22 PM on June 21, 2015 [2 favorites]


Remastersys is used for making a live/bootable image of your system, and can strip out any personal user data.

And upon further reading, may not be suitable for all your needs, but have a read and decide for yourself.
posted by quinndexter at 10:48 PM on June 21, 2015 [1 favorite]


Best answer: You probably (very probably) do not want dd. That's for making low level copies of block devices, where the output bits are arranged the same way as the input bits, and you don't care about the bits, do you? - you care about the files.

Rsync is the right answer for archival copies. The default rsync syntax looks like:
rsync -avn --exclude=/home/* --exclude=/path-to-external-disk \
 /  /path-to-external-disk
which says "synchronize with the archive bits set, in verbose mode, and as a dry run only with no actual bits written, excluding everything in /home, and excluding my destination disk (which matters because of the next bit), the contents of the hierarchy in / (which might include your destination disk if you didn't exclude it and rsync spanned different mounts, which I'm not sure about) to the destination disk."

Look at the output for a few seconds as it scrolls past to make sure you're doing the right thing before you do it again without the "v" or "n" in "-avn" to do it for real. You might want to add more "--exclude= " lines to exclude caches, and /tmp, and so on. And this is fine in a cronjob, with no unmounting of /home or anything like that, after you're confident it is doing the right thing. I'd use "rsync -a --delete --exclude=blah source-list destination" - in fact, I do this all the time from scripts (though not in cron).

But this is a mirroring process, especially if you do it with --delete to get rid of obsoleted files. I would consider that sufficient for my system files, especially if I was alternating two external disks - if I hose the system, I have two steps backed up. If you want true incremental snapshots, though, where you can step back through your system over many weeks, I guess try out rsnapshot mentioned upthread?

Again, think carefully about whether it is worth having a true incremental snapshot of your system files (including caches and temporary files and whatnot) or if two external disks will give you what you need.
posted by RedOrGreen at 2:17 PM on June 22, 2015 [1 favorite]


Response by poster: you don't care about the bits, do you? - you care about the files.

That's the thing---I'm not sure. I know that Linux doesn't have a registry, like Windows does (did?). The only thing that needs to know what programs are on the system will be apt-get, and if I copy over it's needed files, everything should be fine... right? I know not to copy cashes and /tmp and I'll learn more about /var (since it caused the latest mishap, darn it).

I'm just looking for whatever will let me save 100% of my programs and settings such that they can be reinstalled as a group, not one by one by boring one.

I'd like to have a couple of versions saved back, but being able to step through sounds like overkill. I just want to be able to come back from zero after having to wipe the machine because of why-ever, without individual program re-installation. rsync does seem to be in the lead, here.
posted by wires at 3:24 PM on July 4, 2015


Best answer: Ok, after the update, I stand by my advice above about using rsync to mirror your / /sbin /bin /usr /etc (and so on) hierarchy to a (pair of) removable disks. The one thing I need to add is - of course you'll need to do this as root or with sudo, because otherwise you don't have access to the system hierarchy.

Maybe someone else can comment about making system copies on Linux - on a Mac, for example, I'd recommend SuperDuper! to make bootable copies of your entire installation, but it's using the same rsync-type operations under the hood.
posted by RedOrGreen at 9:14 AM on July 6, 2015 [1 favorite]


« Older Roadtrip: Sacramento to the Gorge   |   SMS from USA --> Singapore? Newer »
This thread is closed to new comments.