--one-filesystem bug is now fixed in restic 0.9.0
This commit is contained in:
@@ -24,15 +24,18 @@ exit_hook() {
|
||||
}
|
||||
trap exit_hook INT TERM
|
||||
|
||||
RETENTION_DAYS=7
|
||||
RETENTION_WEEKS=12
|
||||
# How many backups to keep.
|
||||
RETENTION_DAYS=14
|
||||
RETENTION_WEEKS=16
|
||||
RETENTION_MONTHS=18
|
||||
RETENTION_YEARS=4
|
||||
RETENTION_YEARS=3
|
||||
|
||||
# What to backup, and what to not
|
||||
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
|
||||
|
||||
|
||||
# Set all environment variables like
|
||||
# B2_ACCOUNT_ID, B2_ACCOUNT_KEY, RESTIC_REPOSITORY etc.
|
||||
source /etc/restic/b2_env.sh
|
||||
@@ -47,23 +50,18 @@ source /etc/restic/b2_env.sh
|
||||
restic unlock &
|
||||
wait $!
|
||||
|
||||
# Do the backup!
|
||||
# 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 &
|
||||
#wait $!
|
||||
|
||||
# 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
|
||||
# --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.
|
||||
# --tag lets us reference these backups later when doing restic-forget.
|
||||
restic backup \
|
||||
--one-file-system \
|
||||
--tag $BACKUP_TAG \
|
||||
--exclude-file /.restic-excludes \
|
||||
$BACKUP_EXCLUDES \
|
||||
/ &
|
||||
$BACKUP_PATHS &
|
||||
wait $!
|
||||
|
||||
# Dereference old backups.
|
||||
# See restic-forget(1) or http://restic.readthedocs.io/en/latest/060_forget.html
|
||||
restic forget \
|
||||
--tag $BACKUP_TAG \
|
||||
@@ -78,8 +76,9 @@ wait $!
|
||||
restic prune &
|
||||
wait $!
|
||||
|
||||
|
||||
# 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.
|
||||
#restic check &
|
||||
#wait $!
|
||||
|
||||
echo "Backup & cleaning is done."
|
||||
|
||||
Reference in New Issue
Block a user