oracle-virtualbox-logoThis is how I use the VirtualBox snapshot option on my headless server. I use this feature for creating a restore point for a critical mail server upgrade I will soon post about. Because I will use this option more often it comes handy when recorded somewhere.

Specs:

  • Debian 6.0.6 “Squeeze”
  • Virtualbox 4.1.22-80657

See the Virtualbox snapshot syntax below

VBoxManage snapshot | take [--description ] [--pause] | delete | | restore | | restorecurrent | edit ||--current [--name ] [--description ] | list [--details|--machinereadable] showvminfo |

  1. Shutdown the system (taking a snapshot while running resulted in a error)

VBoxManage snapshot vm04-zca8 take snap1-before-upgrade 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

  1. Check if the snapshot is recorded

VBoxManage showvminfo vm04-zca8 <...> Snapshots: Name: snap1-before-upgrade (UUID: fc060f19-9fcc-4559-88df-20f6b61bfb28) *</...>

  1. Start the system:

VBoxManage startvm vm04-zca8 --type headless Waiting for VM "vm04-zca8" to power on... VM "vm04-zca8" has been successfully started.

  1. Now do your thing

  2. In case you need to revert back to the snapshot

VBoxManage snapshot vm04-zca8 restore snap1-before-upgrade Restoring snapshot f96d12f8-4d50-493e-864a-6f7b001594dc 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

  1. Otherwise delete the snapshot because it uses disk space

VBoxManage snapshot vm04-zca8 delete snap1-before-upgrade 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

That’s about it!