Correction mount backup
This commit is contained in:
parent
d4c2027c82
commit
8ad79d1787
|
@ -24,27 +24,19 @@ trap clean_exit INT
|
||||||
|
|
||||||
function clean_exit() {
|
function clean_exit() {
|
||||||
echo "Exiting..."
|
echo "Exiting..."
|
||||||
umount -q /mnt/${vm}
|
|
||||||
umount -q /mnt/${vm}-remote
|
umount -q /mnt/${vm}-remote
|
||||||
sync
|
sync
|
||||||
|
|
||||||
if [ ! -z ${loopdisk} ]; then
|
|
||||||
losetup -d ${loopdisk}
|
|
||||||
fi
|
|
||||||
sleep 3
|
sleep 3
|
||||||
rmdir /mnt${vm}*
|
rmdir /mnt${vm}-remote
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vm=$1
|
vm=$1
|
||||||
dest=$2
|
backuphost=$2
|
||||||
backuphost=$3
|
|
||||||
|
|
||||||
generic_image="/srv/vmverse/installation/generic.a-lec.org.raw"
|
if [[ $# != 2 ]]
|
||||||
|
|
||||||
if [[ $# != 3 ]]
|
|
||||||
then
|
then
|
||||||
echo "ERROR: 3 parameters required : vm domain, destination path, backup host"
|
echo "ERROR: 2 parameters required : vm domain, backup host"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -71,18 +63,10 @@ echo -e "\nOK\n"
|
||||||
|
|
||||||
# Preparing path
|
# Preparing path
|
||||||
echo "Preparing path..."
|
echo "Preparing path..."
|
||||||
mkdir -p /mnt/${vm}
|
|
||||||
mkdir -p /mnt/${vm}-remote
|
mkdir -p /mnt/${vm}-remote
|
||||||
mkdir -p $(dirname ${dest})
|
|
||||||
|
|
||||||
# Creating new disk
|
|
||||||
echo "Creating new disk..."
|
|
||||||
cp --reflink ${generic_image} ${dest}
|
|
||||||
|
|
||||||
# Mounting
|
# Mounting
|
||||||
echo "Mounting devices..."
|
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
|
borg mount root@${backuphost}:/var/backups/borg/${vm}.repo::${DATES[backupdate]} /mnt/${vm}-remote
|
||||||
|
|
||||||
# Syncing
|
# Syncing
|
||||||
|
|
Loading…
Reference in New Issue