Backups: everyone knows they're important, but no one does them until they lose data (or barely escape losing data, if they're lucky).

My old laptop's old hard disk almost died once, and that made me think about backing things up. I read an inspiring article by Joey Hess, and decided to keep most of my home directory (all the numerous small files) in a Subversion repository on a remote server. It worked quite well for almost a year. I changed the hard disk, got a new laptop, and switched Linux distributions (Debian to Ubuntu), and every time all I had to do was install Subversion and check out my home directory.

I can also check out various subdirectories (such as ~/bin, ~/.mutt, ~/.vim) on other machines, and keep useful scripts and configuration files synchronized.

I have a shell script 'autocommit' that runs svn add and svn commit for a few common places (Tomboy notes, Firefox profile, IRC logs). I review changes to other and commit them manually. I have included a large number of automatically generated junk files in svn:ignore properties (~/.gconf falls in this category, since the diffs are numerous and useless).

Some subdirectories are not versioned (~/img, ~/mp3, ~/src, ~/Mail). I back up large amounts of data (such as my photo collection) with rsync. I keep my source trees in separate repositories. I keep all my mail on a IMAP server, and use offlineimap to synchronize it with a bunch of Maildirs on the laptop.

I do not keep my private keys (GPG and SSH) in the repository.

Here's how I do backups:

$ backup-to-musmire

Rsync ~/img, ~/mp3 etc. to my home file server.

$ offlineimap

Synchronize all my mail folders.

$ autocommit

Commit periodically changing files to Subversion.

(The three commands above can be run in parallel)

$ svn st

See if there are any uncommitted changes. If there are, I'll commit them separately with meaningful log messages. If there are unknown files, I'll either svn add and svn commit them, or I'll add them to svn:ignore.