From 8ad79d17874cdce593782e0d8eef7300caf7831c Mon Sep 17 00:00:00 2001 From: admin666 Date: Tue, 21 Nov 2023 23:09:59 +0100 Subject: [PATCH] Correction mount backup --- mount_restore.sh | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/mount_restore.sh b/mount_restore.sh index 6037c77..ada1b16 100755 --- a/mount_restore.sh +++ b/mount_restore.sh @@ -24,27 +24,19 @@ trap clean_exit INT function clean_exit() { echo "Exiting..." - umount -q /mnt/${vm} umount -q /mnt/${vm}-remote sync - - if [ ! -z ${loopdisk} ]; then - losetup -d ${loopdisk} - fi sleep 3 - rmdir /mnt${vm}* + rmdir /mnt${vm}-remote } vm=$1 -dest=$2 -backuphost=$3 +backuphost=$2 -generic_image="/srv/vmverse/installation/generic.a-lec.org.raw" - -if [[ $# != 3 ]] +if [[ $# != 2 ]] then - echo "ERROR: 3 parameters required : vm domain, destination path, backup host" + echo "ERROR: 2 parameters required : vm domain, backup host" exit 1 fi @@ -71,18 +63,10 @@ echo -e "\nOK\n" # Preparing path echo "Preparing path..." -mkdir -p /mnt/${vm} mkdir -p /mnt/${vm}-remote -mkdir -p $(dirname ${dest}) - -# Creating new disk -echo "Creating new disk..." -cp --reflink ${generic_image} ${dest} # Mounting echo "Mounting devices..." -loopdisk=$(losetup -fPL ${dest} --show) -mount ${loopdisk}p1 /mnt/${vm} borg mount root@${backuphost}:/var/backups/borg/${vm}.repo::${DATES[backupdate]} /mnt/${vm}-remote # Syncing