It is a good practice to create a routine snapshot of VMs once per day.  This is not a full backup to off-site media since the snapshot has a differencing disk image and must be on fast storage (same directory as the .vdi in my configuration).  There is also no method to automatically delete these snapshots to prevent them from filling up the host storage.  You will need to manually clean-up the snapshots periodically when the off-site export, clone, or directory copy is made.

Note:  Differencing is done between the latest snapshot and the current disk image – older snapshots are essentially locked unless needed for a restore.  Therefore, it may be faster to delete unneeded \snapshots in reverse order – oldest first – leaving the last one in place during a manual clean-up.

Here is the script I use for the task. It must be created and run in cron as the vboxuser account:

$ cat


 #This script is used to create a daily snapshot for one VM
 #It is scheduled using crontab -e for the vboxuser

 #Email is set in crontab to send the list of snapshots in the directory for manual clean-up

 NOW=$(date +%Y-%m-%d_%T)
 SNAPSHOT_DESCRIPTION="Daily Routine Snapshot created on $NOW"

 VBoxManage snapshot PRTG take "$SNAPSHOT_NAME" --description "$SNAPSHOT_DESCRIPTION"

 echo "Snapshot name: $SNAPSHOT_NAME"
 echo "Snapshot description: $SNAPSHOT_DESCRIPTION"
 echo "Created by: $USER on $HOSTNAME"
 echo "List of current snapshots:"
 VBoxManage snapshot PRTG list

Leave a Reply

Your email address will not be published. Required fields are marked *