I finally have a better backup solution: Restic. This project has emerged as the open source favorite for backups. It’s easy to see why: it’s very capable and a very professional product. Don’t be put off by the scary 0. version number: there’ve been releases for seven years now. And it seems really solid.
For many years now I’ve relied on rsnapshot for backups. It’s nothing fancy but is straightforward. But it basically requires you have root access on both the source machine and the backup server. (rsnapshot stores actual copies of your files, complete with timestamps and owners). And it’s slow and creaky and, well, time for something new.
Restic is very fancy. The underlying repository datastore slices your files up into 1MB blobs and storing them in a sort of content-addressable store. Everything is encrypted and indexed by the SHA256 hash of the data. That makes verification, deduplication, etc straightforward and fast. The downside is the backup format is entirely opaque; you need the restic binary to work to restore files. (It is documented, but far too complicated to easily reimplement.) The upside is it is very efficient.
The product packaging is fantastic for open source. It ships as a single self contained Go binary. The docs are terrific including a quickstart that gives a vey good experience. It supports a wide variety of backup server types from local disk to sftp to cloud providers (or rclone if you want to do your own thing). There’s good tools for inspecting backups, verifying them, restoring them (including a FUSE mount). Also a first class tool for removing old snapshots. The tool gives a lot of confidence.
restic runs really well and fast. I can back up 50GB of my data to 38GB in the repo in about 6 minutes, about the speed the disk runs at (and this over NFS). An empty incremental takes just 10 seconds.
The one thing missing is some usability for system integration; you’re left writing your own shell scripts and cron jobs to use it. Fortunately there’s a CLI frontend called resticprofile which helps with that stuff, driven by a simple config file. It’s not quite as clean a product as restic itself but it has good docs and seems to work well. And what it does is not mysterious, it’s just invoking restic, so I’m not as concerned about the niceties.
Edit: another option for managing restic is backrest, a web GUI. Update Aug 2024: finally gave this a try, it is very nice.
It’s a real pleasure to use a nicely built open source tool like restic.
Update 2: offsite backups
I’m using Backblaze now for offsite backups. It seems to work OK and is fast and cheap ($6/TB/mo with no minimum. plus extra for bandwidth if you use much.) Was fairly straightforward to get working with Restic. Configuring the bucket is a bit tricky; I turned off encryption (restic is encrypted already) and file retention.
I tried SFTP briefly to a small server I have. It was very slow, like 6 minutes for 2GB (or less). To be fair my server is slow.
Update: system backup config
Here’s the fairly simple resticprofile config I’m using to back up my main Linux system. It backs up to local disk once an hour and keeps old dailies, weeklies, monthlies, and yearlies on a reasonable schedule. The only subtle thing here is I’m backing up in two separate jobs, once for my home filesystem and once for the system root.
version = "1"
[global]
ionice = true
nice = 5
scheduler = "crond"
restic-binary = "/usr/local/bin/restic"
[default]
repository = "local:/mnt/backup/restic"
password-file = "/usr/local/etc/restic/password"
# Everything but my home directory
[root]
inherit = "default"
[root.backup]
source = [ "/" ]
exclude = [ "/home/nelson", "swap.img" ]
one-file-system = true
schedule = "*-*-* *:37:15"
schedule-permission = "system"
schedule-log = "/var/log/restic.log"
[root.retention]
keep-hourly = 24
keep-daily = 7
keep-weekly = 4
keep-monthly = 60
after-backup = true
# My home directory
[home]
inherit = "default"
[home.backup]
source = [ "/home/nelson" ]
one-file-system = true
schedule = "*-*-* *:07:15"
schedule-permission = "system"
schedule-log = "/var/log/restic.log"
[home.retention]
keep-hourly = 24
keep-daily = 7
keep-weekly = 4
keep-monthly = 60
after-backup = true