Borg Backup

In order to create offsite backups for my various self-hosted services I use BorgBackup. It is heavily inspired by their Automating backups article.


Download this backup script and place it in /bin/borg-backup.

This script supports adding a .nobackup file to a directory to avoid backing it up.

First, create the borg repository. This command will prompt you for a passphrase to encrypt the backup with.

borg init --encryption=repokey /path/to/repo.borg

Create a cronjob with sudo crontab -e to run this script at some interval:

0 17 * * * export BORG_PASSPHRASE=password; borg-backup /path/to/repo.borg /path/to/dir

Backblaze B2

I use the following naming structure for B2 buckets and Borg repositories:

  • Borg repository: service-name.borg
  • Bucket name: service-name-borg

Create a script at /bin/rclone-sync with the contents:

rclone sync "/mnt/backup/$1.borg" "backblaze-$1:$1-borg"

To sync these Borg repositories to Backblaze B2 I use Rclone in a crontab with the following:

0 19 * * * export RCLONE_CONFIG_PASS=CONFIG_PASS; rclone-sync service-name

This will sync the service-name.borg repo to the bucket service-name-borg in B2.


Content properties

  • Type: Note
  • Category: Self Hosting
  • Tags: ops, privacy
  • Custom slug: None

This is a preview of a simpler page design that I'm working on over the next little bit. I've finally added a (click it!) but there's still a few pages left to be converted so don't worry if things don't look quite right just yet 🙏

Content on blog pages use the CC-BY-SA license. The source code and notes use the MIT license. Unsure? Mention me on Mastodon.