I finally did the thing I've been putting off since basically forever: real, automated, off-site backups for my home server. Not "I copied some files to a USB drive that one time in 2019" backups. Actual ones, that run every night whether I remember or not.
Here's the embarrassing part. I've been running this blog and a pile of other junk off a little home server in the closet for years, and my backup strategy was "eh, most of it's on GitHub anyway." Which is fine for code. It is not fine for the fourteen years of blog photos, the Plex library metadata I spent an unreasonable number of hours curating, or the folder of scanned documents I keep meaning to actually organize. Last month my main drive started clicking. Not loudly. Just a little tick every few minutes, the kind of sound that makes you sit very still and reconsider your life choices. It didn't die. But it scared me straight.
So, restic. If you haven't used it, its a backup tool written in Go that does deduplication, encryption, and incremental snapshots, and it just works from the command line without a bunch of ceremony. I paired it with Backblaze B2 for storage because its cheap: six tenths of a cent per GB per month, no egress fees if you're not pulling data out constantly, and setup took maybe ten minutes including making the account.
The actual setup
- Install restic (
apt install resticon Debian, or grab a binary off their releases page if your distro's version is stale, which it usually is). - Make a B2 bucket. I called mine
techpad-homeserver-backup, original I know. - Create an application key scoped just to that bucket. Don't use your master key for this, obviously.
- Init the repo:
export B2_ACCOUNT_ID=xxxx
export B2_ACCOUNT_KEY=xxxx
restic -r b2:techpad-homeserver-backup:/ init
- Back things up:
restic -r b2:techpad-homeserver-backup:/ backup /srv/data /home/ramith/photos --exclude-caches
- Then the part everyone skips: prune old snapshots so you're not paying to store nineteen copies of the same 2 GB folder forever. I run
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --pruneonce a week via cron.
The first backup took about six hours because I have somewhere north of 400 GB of stuff, most of it photos I will never look at again but am psychologically incapable of deleting. Every backup after that has taken under four minutes because restic only uploads what changed. That part genuinely impressed me, and I don't impress easy anymore, fifteen years into writing about this stuff will do that to you.
One thing that annoyed me: restic's default chunking made my initial upload chew through more of my monthly bandwidth allotment than I expected, since B2's free tier egress doesn't help you at all when you're the one pushing data up. Not a huge deal on a home fiber connection but if you're on anything metered, kick off that first backup and go do something else for an evening.
I also set up a second, totally separate restic repo pointed at a spare external drive that lives at my parents' place, because the whole point of the 3-2-1 rule (three copies, two different media, one off-site) falls apart if your "off-site" backup and your primary server are both plugged into the same power strip in the same closet. A lot of people treat backups as a checkbox ("yep, got a backup") without asking whether that backup would actually survive the specific disaster they're worried about. A cloud copy that only protects you from drive failure doesn't protect you from, say, a house fire, and vice versa with a local external drive.
Total monthly cost for the B2 side, with about 400 GB stored and the pruning schedule above keeping it from ballooning, comes out to roughly $2.40. Less than one coffee. I spent more time last week arguing with myself about whether to exclude my node_modules folders from the backup set (I did, they're regenerable) than I've spent worrying about drive failure in the eleven days since I set this up.
If your backup situation is currently "it's fine, probably," it's worth the one evening it takes to fix it properly. Restic's docs are good, the CLI is forgiving, and B2's dashboard doesn't try to upsell you every time you log in, which after using AWS for anything is genuinely refreshing.
Next up I want to figure out restic REST server so I can back up my laptop straight to the home server too, instead of relying on Time Machine and hoping. That's a project for another weekend, probably one where the drive isn't clicking at me.