The advice is omnipresent: “Thou shalt backup your files!”
Well, I didn’t bother until recently, because I never really had a nasty disk failure or similar cataclysm destroying my data. When it actually happened, I started to think about a decent backup strategy.
The Files
What actually needed to be backed up?
- Documents, Sourcecode, Savegames, etc.
- Mails, Calendar, etc.
- Application Configuration (e. g. Firefox preferences)
- System Configuration (e. g. Timezone, Keyboard layout)
Because I’m running Linux, most of that already resides in my home-directory (1, 2, 3), so I don’t have to go hunting for it all over the harddisk. The remainder luckily also is grouped together – all system configuration resides in a directory called etc. I wonder where that name came from…
Okay. All my important files are accounted for, but there are also some files among them which are not very desirable in a backup:
- Caches: They only waste space, since they are automatically rebuilt when they are not available. The best example is probably the Browser Cache, which takes up 25 MiB on my system.
- The Trash: Well, I deleted the stuff, why would I want to back it up? As for accidental deletion, that is unlikely enough to coincide with a system breakdown that I don’t bother – most of my important files arrive by mail anyway, and are stored on the server for easy re-retrieval.
- Spam: Of course my mail is backed up, but there is no need to keep the snake-oil sales pitches.
- Temporary files: Many programs litter the harddisk with temporary files. And because they are temporary, I don’t want them in a permanent Backup. Easy as that. :-)
The Program
Now that I had established what I wanted, and what I didn’t want, I had to look for a program that could make a nice package from my files. The first one I considered was good ole GNU tar – it did most of what I wanted, but all in all, it was a little cumbersome for backup purposes (despite that being exactly its intended usage… after all tar is short for Tape ARchiver).
Enter dar, the Disk ARchiver. I found it on Freshmeat while looking for something more versatile than tar. In addition to full and differential backups, it offers a host of other features: slicing the backup into fixed size chunks, compression (Yeah, yeah. Usually no good for backups, but there are some safeguards, and IMO the risks are bearable), PARchive support, direct access to files (no need to untar the whole archive), strong encryption support (Blowfish) and others.
My Setup
I had a spare partition of 500 or so MebiBytes on a different disk than the one my home- and etc-directories reside on, so I set that up – in case of disk failure it would be safe, but in case of a meteorite impact, it would not. :P
I made a full backup there, totalling about 150MB. I also burnt that to a CD-R, together with DAR and the DAR documentation. Then I modified the scripts from the DAR differential backup mini-howto to suit my needs and put them into the crontab. From now on, DAR would make a differential backup on my spare partition every day. Since the backup is differential, it would weigh in at at most a few MB. Every week or so I could then burn the differential backups to the CD-R the full backup resides on. Once the CD is filled, I will make another full backup for a different CD-R and again fill it up with differential backups.
Another approach would be to let DAR split everything into 10MB chunks (or slightly less, accounting for Base64-encoding-growth) and directly mail the files to, say, MyAccount+Backup@gmail.com.
Edit: I did not take into account that every session on a multisession CD takes 13 MiB by itself, so it is pretty inefficient to burn the differential backups directly. On the one hand, CD-Rs are cheap, but on the other hand I hate inefficiencies such as this one, and so decided to cache the diffs on my USB Stick for now, and only burn them every month.
Tags: dar, Backup, Data safety