Backups

So, it’s been another year and I’m getting better settled in to Linux. I’ve run through a lot of different window managers and desktop environments, like KDE, i3 and WindowMaker, before settling on DWM. Add to that more than a fair share of auxiliary programs to flesh out the experience and make things customized for me.

To that end, I’ve been trying to ensure that if anything should fail,I have a good backup to restore from. Enter Borg. It’s a command-line driven backup tool that not only compresses and encrypts the contents,but it de-duplicates it. This is fantastic for lots of little text files and the occasional photo set. The problem for me was, it was a lot of hassle feeding it all the options needed every time. Sure, I could alias it to make it simpler, but that still left a bit of work for me to do to get everything sorted, including un/mount the backup share, putting in a myriad of passwords, checking for number of incremental backups and pruning them so that I’m not dropping hundreds of gigabytes of useless, mostly similar backups (dedup’d or not) on my server, and on my offsite storage.

So, like most things on Linux, I glued all this together in a simple Fish Shell function. This allows me to just run a command (or add it as a user systemd timer) that backs everything I care about up, prunes and does all the drudgery of making a nice secure backup. Here’s myscript/function that makes this all easier.

Published by

Nathan

Nathan is a technologist who loves Open Source Software, sleep and coffee.