Finally, encrypted, fast offsite backups

UPDATE: As of June 2017 March 2019, this is still current, and the way I still do my backups. So far, it’s been working fantastically well, and I still recommend this.

If you’ve been reading my ramblings for a while, you will remember that I have been looking for a good way to back up my files, without much luck. My requirements are:

  • Encrypted (on the original machine).
  • Fast/bandwidth-efficient (deduplication is a plus).
  • Open-source.
  • Cheap.

My files are mostly code and photos, which aren’t really critical (the critical files are stored in repositories and multiple computers), but losing all my photos wouldn’t be too great. That’s why any backup solution I wanted had to be cheap enough to justify the cost.

Every single piece of software I have ever tried fails in at least one of the above. I currently use SpiderOak, which is everything except open-source, so that fails too.

However, my quest is finally over. I have discovered the Holy Grail of backups, and its name is Attic Borg. I don’t know how it took me this long to find, but there you have it.

UPDATE: I have now switched over to Borg, which is a fork of Attic that is very well-maintained. I have updated the article to reflect this.

Borg

An atticMuch nicer than this

Borg is an open-source, encrypting, deduplicating backup manager. This means that all your data is securely stored on a remote server, while only new data is transferred every time you create a backup. The fact that it’s open source means that it’s easy for people to audit for vulnerabilities, or for things that don’t make sense.

Using Borg is very easy. The quick start guide details all the usage instructions, so I won’t replicate them here, but the quick rundown is that you initialize a repository on a server (local or remote) and then start creating archives. Since Borg is deduplicated, it will only transfer files that don’t exist in the repo, saving you time and money.

Storage

Backup programs are great, but where does one actually store the files? SpiderOak is around $60/year for 150 GB, but everything else is pretty expensive (except S3, which Borg can’t easily support, as it needs a Borg server running on the remote end). Luckiily, I found rsync.net which is super easy to manage (you basically just point Borg to it and start creating your archives). This isn’t an affiliate link and I don’t make any money if you buy an account, I just like and recommend them.

You can’t really beat the peace of mind this provides you for around $30 a year. My only concern was with bit rot, as I didn’t want to suddenly find that my provider’s hard disk had some bad sectors, making my backups unreadable. Fortunately, Borg has a solution for that, with its borg check command. borg check checks your repository’s files, making sure the checksums of the files match what is actually stored on disk.

Another consideration when selecting a backup program is the ease of keeping multiple backups. I don’t want to keep daily backups for ever, but I do want to keep a few from a few months ago, in case I delete something and don’t notice for ages. Fortunately, Borg has thought of that too, and allows you to keep as many daily/weekly/monthly/yearly backups as you want. For example, you could say that you want 7 daily backups (for the last week), and 4 weekly ones (for the last month). That would get you one backup per day in the last week, and one backup per week in the last month. Pretty handy!:

borg prune $REPOSITORY --keep-daily=7 --keep-weekly=4 --keep-monthly=6

Restoring files

Borg is great when restoring files as well. It doesn’t just allow you to restore the entire backup or single files, but it allows you to mount the backup as a filesystem so you can browse it and copy single files out of it! That is magical, and is one of the features that made me fall in love with it. It allows me to go back to a point in time and restore files from it in a very natural way, as if my old filesystem were just there:

borg mount /data/myrepo::root-2013-08-02 /tmp/mymountpoint

Epilogue

If you have any data you want to store offsite (which you should if you have any data at all), give Borg a try. It’s perfect for my use case (lots of non-life-and-death photos), and it really shines for backing up any sort of data.

If you have any other recommendations, or have been using Borg and are happy/unhappy, please leave a comment below, or I will also be expecting your comments below, or Tweet at me. I’m especially interested in hearing from people who were unsatisfied by it, as those are generally the most interesting experiences, especially when it comes to backups.