{VMBACKUP] Forward to latest

This commit is contained in:
Simon Cornet 2019-06-19 09:17:40 +02:00
parent 9436ebca9b
commit 29b3a7b163

View File

@ -17,10 +17,10 @@ foreach vm (`ls /usr/vms | \
vm stop $vm
## give vm time to shut down properly
sleep 5
sleep 15
## snapshot vm
echo "Snapshot VM: $vm"
echo "Snapshot VM: $vm"
zfs snapshot $vm_dataset/$vm@$backup_date
echo ""
@ -38,12 +38,16 @@ foreach vm (`ls /usr/vms | \
grep -v .iso | \
grep -v .templates`)
## Create ZFS dataset
echo "Creating destination dataset for $vm"
zfs create $backup_dataset/$vm-$backup_date
## Send snapshot to backup destination
echo "Backup VM: $vm"
zfs send $vm_dataset/$vm@$backup_date | pv | zfs recv -F $backup_dataset/$vm
echo "Backup VM: $vm"
zfs send $vm_dataset/$vm@$backup_date | zfs recv -F $backup_dataset/$vm-$backup_date
echo ""
## Delete snapshot
## Delete snapshot
zfs destroy $vm_dataset/$vm@$backup_date
end
@ -51,4 +55,4 @@ end
# report done
echo ""
echo "############### ALL DONE THANKS ###############"
echo ""
echo ""