VirtualBox snapshots using the CLI

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 |
- 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%
- Check if the snapshot is recorded
VBoxManage showvminfo vm04-zca8 <…> Snapshots: Name: snap1-before-upgrade (UUID: fc060f19-9fcc-4559-88df-20f6b61bfb28) *</…>
- Start the system:
VBoxManage startvm vm04-zca8 –type headless Waiting for VM “vm04-zca8” to power on… VM “vm04-zca8” has been successfully started.
- Now do your thing
- 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%
- 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!