Skip to content

Instantly share code, notes, and snippets.

@boina-n
Last active February 20, 2017 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boina-n/c9351bf1dc145348c17a7d5d6b5038f4 to your computer and use it in GitHub Desktop.
Save boina-n/c9351bf1dc145348c17a7d5d6b5038f4 to your computer and use it in GitHub Desktop.
virtualbox snapshot and clone commands
#!/bin/bash
rm -rf /opt/application/PCF-DEV/pcfdev/clones/$(date +"%Y%m%d" --date="+2 days ago").pcfdev-v0.389.0
vboxmanage clonevm pcfdev-v0.389.0 --basefolder /opt/application/PCF-DEV/pcfdev/clones/ --name $(date +"%Y%m%d").pcfdev-v0.389.0
# 1. Take a snapshot
vboxmanage snapshot pcfdev-v0.389.0 take $(date +"%Y%m%d").pcfdev-v0.389.0
# 2. Clone the Snapshot
vboxmanage clonevm pcfdev-v0.389.0 --snapshot $(date +"%Y%m%d").pcfdev-v0.389.0 --basefolder /opt/application/PCF-DEV/pcfdev/clones/ --name $(date +"%Y%m%d").pcfdev-v0.389.0
# 3. Delete the snapshot
vboxmanage snapshot pcfdev-v0.389.0 delete $(date +"%Y%m%d").pcfdev-v0.389.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment