Random Geekage

Backup Strategy

Just over 2 years ago I wrote a post about my backup strategy. Back then, I was using rsnapshot as my utility of choice. However, that has been deprecated in the Debian repos so I figured I would use the opportunity to switch to using Borg.

Pig Monkey has done the vast majority of the heavy lifting with a wrapper script. I have basically just made a few versions of that wrapper with a couple of tweaks to increase the retention times, as well as multiple backup locations (storage is cheap and plentiful, I have a 2.5" USB3 hard drive and a beefy Synology NAS). I also have offsite backups thanks to rsync.net.

Again, like the previous post, there are a handful of systemd units set to start the backups every hour, depending on what network I am on.

Date: Tagged with backups

Backup Strategy

2021-11-21 update: this setup is obsolete, see here for the new hotness

We have all lost data at some point. Whether it is an accidental fat fingered rm -r or hardware failure or something else, it sucks. Having a decent backup solution helps ease the pain and hassle.

In a previous life, when I used an Apple machine, I had a hard drive set up with Time Machine for local backups and I used Backblaze for off site storage. Now that I am back on a Linux machine, a different approach is used.

The main backups are handled by rsnapshot which backs up my home directory to a hard drive that is always plugged in whenever I am connected to my dock. The config file specifices several levels and retention amounts:

  • Hourly: 24 backups (assuming the computer is on) per day
  • Daily: 7 backups, one for every day of the week
  • Weekly: 4 backup to correspond to 4 weeks a month
  • Monthly: 12 a year, once a month
  • Yearly: just the one

These are kicked off by systemd services and timers. The clever bit is only needing one service and timer and using arguments to determine the backup level. Running systemctl --user enable --now backup@hourly.timer sets up the hourly backup, systemctl --user enable --now backup@daily.timer sets up the daily and so on. The unit files are stored in ~/.config/systemd/user/ so as to not need to mess around with root permissions or setting up another user. I only care about my home directory, if the system itself becomes bad, I can easily blow it away and reinstall then pull from my backups.

The backup drives are many and redundant. The hotstore drive I have plugged in all the time, I have 2 coldstore drives which are kept in a Pelican 1200 case and I have just provisioned one offsite drive, cunningly named for being stored outside of my home so that in the event of a fire or what have you, I at least have a semi-up to date copy of my stuff.

Of course, having data encrypted at rest is always a good idea. All of the drives are set up using my encryption script which uses some sensible defaults to help protect my data.

Data replication is handled by a script called (funnily enough) syncstuff which is basically a wrapper around rsync. Takes a while to do the job but I am happiest with that way of doing it. This also syncs up my documents and mail to the various drives, as well as a microsd kept on a necklace most of the time.

Date: Tagged with backups
© . Powered by Pelican.
Creative Commons Licence This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.