Support #439
Using VBoxManage To Take Virtual Machine Snapshot on Linux
Description
While managing a small NodeJS instance, I decided to upgrade to the newest development branch of the software I am using. Since I am using VirtualBox, I chose take advantage of the snapshot capability; by taking a preliminary snapshot and then upgrading, I can then revert to that snapshot if the upgrade fails. It's the perfect server undo button.
Taking a snapshot of a VM¶
- Take a snapshot of a virtual machine
VBoxManage snapshot "examplevm" take "prebackup" --live
NOTE: The above command will take a live snapshot of the virtual machine, without interrupting any functions the VM is providing. The --pause command can be used to pause the VM while snapshotting.- After the snapshot creation is completed, you can power off the machine and restore it:
VBoxManage snapshot "examplevm" restorecurrent
- After the snapshot creation is completed, you can power off the machine and restore it:
Revert Snapshot¶
- To Discard current changes
VBoxManage snapshot "examplevm" discardcurrent
- Revert to last snapshot:
VBoxManage snapshot "examplevm" discardcurrent
- To see Snapshot information about a particular VM
VBoxManage snapshot "examplevm" discard "prebackup"
Merging snapshots into a base VDI¶
If there is a need to apply the changes made since the snapshot was taken, then merging the snapshot that was taken into the Virtual Disk Image used by the virtual machine is necessary.
- To merge a snapshot into a VDI run:
VBoxManage clonehd /full/path/to/{uuid-of-last-snapshot}.vdi thedisk-full.vdi
So I should clonehd only the last snapshot, not every snapshot from the chain. And it is thousands percent faster.