{VMBACKUP] Forward to latest
This commit is contained in:
parent
9436ebca9b
commit
29b3a7b163
@ -17,10 +17,10 @@ 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"
|
||||||
zfs snapshot $vm_dataset/$vm@$backup_date
|
zfs snapshot $vm_dataset/$vm@$backup_date
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
@ -38,12 +38,16 @@ 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
|
||||||
zfs destroy $vm_dataset/$vm@$backup_date
|
zfs destroy $vm_dataset/$vm@$backup_date
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -51,4 +55,4 @@ end
|
|||||||
# report done
|
# report done
|
||||||
echo ""
|
echo ""
|
||||||
echo "############### ALL DONE THANKS ###############"
|
echo "############### ALL DONE THANKS ###############"
|
||||||
echo ""
|
echo ""
|
Loading…
Reference in New Issue
Block a user