Effective backup strategy?

So one more blog post before I’m going to write a comprehensive guide on how I’ve built my network. Hopefully making sure that I haven’t exposed any glaring security holes which would be really stupid to then tell everyone, hey here’s how you can hack me! 😀

But before that, backups, or lack of them. I haven’t really needed an effective backup strategy. All my personal stuff has been in Dropbox, which I have a Family Plan, where me and my partner can put our shared assets.

All my work stuff, has been on whatever they have chosen, mainly Google Drive and other apps they deem to use.

But in the era of self hosting, you actually have data you need to backup, and you need to figure out an effective strategy to do so, taking all kind’s of things into consideration.

So what do you need to think about?

  • You’re going to backup hundreds of gigabytes, you can’t save duplicate copies multiple times anywhere, it’s not feasible. So you want incremental/snapshot capability.
  • You need to password protect your backups.
  • You need to follow 3-2-1 strategy, where 3 copies, 2 different medias, 1 remote.

Restic ftw!

So after a lot of googling, there is a ton of different ways to handle backups, but for me, the two that rose were Borg, and Restic.

And I chose restic, purely, well, I liked it. More than Borg. No idea why, it’s just a feeling, like many things in FOSS! But mainly, Restic handle’s backups so that the client does everything, and you can just backup to basicly any directory you want via any protocol you want.

And since I adore docker, I also found this, which helps me in my quest of perfect backups: Restic-React-Server.

Rclone for external backups

And the second piece of the puzzle, was how and where to do external backups? Well, I already have dropbox account, so why not there. And there’s a tool already, rclone, which you can basicly use to copy, sync or do stuff with external repositories. Perfect.

Cron trouble

So after a lot of fumbling, figuring out that Cron doesn’t load environment variables, I finally managed to do two scripts, one for restic backups, and one for just syncing the restic repository to dropbox.

You can snatch them from here if you want: restic-backup-scripts

So with a lot of trouble, trying to get and understand why stuff doesn’t work and why they do work, everything is now happily in place. And I can at least be prepared, that, my Immich database and files are stored somewhere safe.