{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,7 +17,7 @@ foreach vm (`ls /usr/vms | \
vm stop $vm vm stop $vm
## give vm time to shut down properly ## give vm time to shut down properly
sleep 5 sleep 15
## snapshot vm ## snapshot vm
echo "Snapshot VM: $vm" echo "Snapshot VM: $vm"
@ -38,9 +38,13 @@ foreach vm (`ls /usr/vms | \
grep -v .iso | \ grep -v .iso | \
grep -v .templates`) grep -v .templates`)
## Create ZFS dataset
echo "Creating destination dataset for $vm"
zfs create $backup_dataset/$vm-$backup_date
## Send snapshot to backup destination ## Send snapshot to backup destination
echo "Backup VM: $vm" echo "Backup VM: $vm"
zfs send $vm_dataset/$vm@$backup_date | pv | zfs recv -F $backup_dataset/$vm zfs send $vm_dataset/$vm@$backup_date | zfs recv -F $backup_dataset/$vm-$backup_date
echo "" echo ""
## Delete snapshot ## Delete snapshot