Backups with Restic
I haven external drive with an ext4 partition on /dev/sdb1
Initialising the backup media
First, label the partition
sudo e2label /dev/sdb1 my_restic_backup
Add it to fstab:
LABEL=my_restic_backup /mnt/backup ext4 rw,noauto 0 0
Create the restic repo
I’m using Pass, so generate the backup key
mount /mnt/backup
pass generate my-restic-backup 64
pass -c my-restic-backup
restic init --repo /mnt/backup/restic-repo
Configuring Restic
I find it easier to create an excludes.txt, basically the restic
equivalent of .gitignore
Exclude any except things I want to backup, eg
/root/excludes.txt:
/*
!/etc/apt/sources.list
!/etc/default/keyboard
!/etc/lightdm/lightdm.conf
!/etc/locale.conf
!/etc/network/interfaces
!/etc/systemd/system/user-suspend@.service
!/etc/udev/rules.d/95-hdmi-plug.rules
!/etc/X11/xorg.conf.d
!/root
!/opt
!/home
Backing up
restic -r /mnt/backup/my-restic-repo backup --verbose --one-file-system --exclude-file=/root/excludes.txt /
This is will appear as a new snapshot:
restic -r /srv/restic-repo snapshots