Add borg check and rename options

Because we added borg check functionality, some of the Options have been
renamed:
-C -> -V
-E -> -e (as it is a sub)

-C: check
-y: --verify-data
-p: prefix or glob for check

Internal variables with CHECK have been renamed or changed to VERIFY

Borg -C without any extra parameters is equal to borg check.
-y adds the --verify-data and -p is a mix of the -P and -a options. If
there is a "*" in the option then -a will be used, else -P

Note that repair command has to be run manually. Run -C with -v
(verbose) to see the repair command structure.

borg check can take a long time on very large repositories.
This commit is contained in:
Clemens Schwaighofer
2022-04-18 15:30:03 +09:00
parent b5ead9a2e1
commit 2ae05f5302
9 changed files with 190 additions and 103 deletions

View File

@@ -1,5 +1,8 @@
#!/usr/bin/env bash
echo "${0} Currently not checked";
exit;
set -e -u -o pipefail
# mount this servers borg backup to a folder
@@ -13,7 +16,7 @@ SETTINGS_FILE="borg.backup.settings";
# base mount path (default)
MOUNT_PATH="/mnt/restore/";
# backup path to borg storage
ATTIC_BACKUP_FILE='';
BORG_BACKUP_FILE='';
# if we are mount or unmount (default is mount)
UMOUNT=0;
@@ -42,7 +45,7 @@ while getopts ":c:m:uf:h" opt do
UMOUNT=1;
;;
f|file)
ATTIC_BACKUP_FILE=${OPTARG};
BORG_BACKUP_FILE=${OPTARG};
;;
h|help)
usage;
@@ -69,7 +72,7 @@ fi;
if [ ${UMOUNT} -eq 0 ]; then
TARGET_SERVER='';
if [ -z "${ATTIC_BACKUP_FILE}" ]; then
if [ -z "${BORG_BACKUP_FILE}" ]; then
if [ ! -f "${BASE_FOLDER}${SETTINGS_FILE}" ]; then
echo "Cannot find ${BASE_FOLDER}${SETTINGS_FILE}";
exit 0;
@@ -82,7 +85,7 @@ if [ ${UMOUNT} -eq 0 ]; then
fi;
REPOSITORY=${TARGET_SERVER}${TARGET_FOLDER}${BACKUP_FILE};
else
REPOSITORY=${ATTIC_BACKUP_FILE};
REPOSITORY=${BORG_BACKUP_FILE};
fi;
# check that the repostiory exists