--one-filesystem bug is now fixed in restic 0.9.0

This commit is contained in:
Erik Westrup
2018-05-29 16:02:25 +02:00
parent 23eb1e068a
commit b8597b4437
+15 -16
View File
@@ -24,15 +24,18 @@ exit_hook() {
} }
trap exit_hook INT TERM trap exit_hook INT TERM
RETENTION_DAYS=7 # How many backups to keep.
RETENTION_WEEKS=12 RETENTION_DAYS=14
RETENTION_WEEKS=16
RETENTION_MONTHS=18 RETENTION_MONTHS=18
RETENTION_YEARS=4 RETENTION_YEARS=3
# What to backup, and what to not
BACKUP_PATHS="/ /boot /home /mnt/media" BACKUP_PATHS="/ /boot /home /mnt/media"
BACKUP_EXCLUDES="--exclude-file /.rsync_exclude --exclude-file /mnt/media/.rsync_exclude --exclude-file /home/erikw/.rsync_exclude" BACKUP_EXCLUDES="--exclude-file /.backup_exclude --exclude-file /mnt/media/.backup_exclude --exclude-file /home/erikw/.backup_exclude"
BACKUP_TAG=systemd.timer BACKUP_TAG=systemd.timer
# Set all environment variables like # Set all environment variables like
# B2_ACCOUNT_ID, B2_ACCOUNT_KEY, RESTIC_REPOSITORY etc. # B2_ACCOUNT_ID, B2_ACCOUNT_KEY, RESTIC_REPOSITORY etc.
source /etc/restic/b2_env.sh source /etc/restic/b2_env.sh
@@ -47,23 +50,18 @@ source /etc/restic/b2_env.sh
restic unlock & restic unlock &
wait $! wait $!
# Do the backup!
# See restic-backup(1) or http://restic.readthedocs.io/en/latest/040_backup.html # See restic-backup(1) or http://restic.readthedocs.io/en/latest/040_backup.html
#restic backup --tag $BACKUP_TAG --one-file-system $BACKUP_EXCLUDES $BACKUP_PATHS & # --one-file-system make sure we only backup exactly those mounted file systems specified in $BACKUP_PATHS, and thus not directories like /dev, /sys etc.
#wait $! # --tag lets us reference these backups later when doing restic-forget.
# Until
# https://github.com/restic/restic/issues/1557
# is fixed with the PR
# https://github.com/restic/restic/pull/1494
# we have to use a work-around and skip the --one-file-system and explicitly black-list the paths we don't want, as described here
# https://forum.restic.net/t/full-system-restore/126/8?u=fd0
restic backup \ restic backup \
--one-file-system \
--tag $BACKUP_TAG \ --tag $BACKUP_TAG \
--exclude-file /.restic-excludes \
$BACKUP_EXCLUDES \ $BACKUP_EXCLUDES \
/ & $BACKUP_PATHS &
wait $! wait $!
# Dereference old backups.
# See restic-forget(1) or http://restic.readthedocs.io/en/latest/060_forget.html # See restic-forget(1) or http://restic.readthedocs.io/en/latest/060_forget.html
restic forget \ restic forget \
--tag $BACKUP_TAG \ --tag $BACKUP_TAG \
@@ -78,8 +76,9 @@ wait $!
restic prune & restic prune &
wait $! wait $!
# Check repository for errors. # Check repository for errors.
# NOTE this takes much time (and data transfer from remote repo?), do this in a separate systemd.timer which is run less often. # NOTE this takes much time (and data transfer from remote repo?), do this in a separate systemd.timer which is run less often.
#restic check & #restic check &
#wait $! #wait $!
echo "Backup & cleaning is done."