diff --git a/FreeBSD/vm-backup.csh b/FreeBSD/vm-backup.csh index e957dff..702eeb3 100644 --- a/FreeBSD/vm-backup.csh +++ b/FreeBSD/vm-backup.csh @@ -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 "" \ No newline at end of file