System backups with BorgBackup and BorgBase

2020/09/23 by Paulo Pereira

~/categories/Linux #Linux #Arch Linux #BorgBackup #BorgBase

Since my last post on BorgBackup and BorgBase, I have subscribed to a 1 TB annual plan and have my daily and weekly /home backups running.

The next thing to setup is my system backups. For this (for now) I’m using a more weekly manually approach.

Installation

sudo pacman -S borg

Setup

sudo ssh-keygen -o -a 100 -t ed25519
sudo cat /root/.ssh/id_ed25519.pub

Here you must choose a strong password.

sudo borg init --encryption=repokey-blake2 XXXXX@XXXXX.repo.borgbase.com:repo

Backup

Every time you want to create a new backup just execute:

sudo borg create --list --progress --info --log-json --json --filter=AM -C lz4 --exclude '/root/.ssh/' XXXXX@XXXXX.repo.borgbase.com:repo::desktop-system-{now:%Y-%m-%dT%H:%M:%S} /etc /var /root /opt

Checking your archives

You can list the archives or files you have and mount them to explore the backed up files.

sudo borg list XXXXX@XXXXX.repo.borgbase.com:repo
sudo borg list XXXXX@XXXXX.repo.borgbase.com:repo::desktop-system-2020-09-23T17:38:52
mkdir /tmp/mount
sudo borg mount XXXXX@XXXXX.repo.borgbase.com:repo::desktop-system-2020-09-23T17:38:52 /tmp/mount
sudo ls /tmp/mount
sudo ls -l /tmp/mount/etc/fstab
sudo borg umount /tmp/mount

Cleaning your archives

It’s also a good idea to prune your repository to clean out older files.

sudo borg prune -v --list --stats --keep-within=10d --keep-weekly=4 --keep-monthly=6 --keep-yearly=2 XXXXX@XXXXX.repo.borgbase.com:repo