Project

General

Profile

Support #439

Updated by Daniel Curtis over 9 years ago

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.  

 h2. Take a * If you are going for VirtualBox you can take the snapshot of a virtual machine from the graphical user interface or from the command line: 
 <pre> 
 VBoxManage snapshot "examplevm" take "prebackup" --live 
 </pre> 
 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. 

 h2. * After the snapshot creation is completed, you can power off the machine and restore it: 
 <pre> 
 VBoxManage snapshot "examplevm" restorecurrent 
 </pre> 

 h2. Revert Snapshot  

 * To Discard current changes 
 <pre> 
 VBoxManage snapshot "examplevm" discardcurrent 
 </pre> 

 * Revert to last snapshot: 
 <pre> 
 VBoxManage snapshot "examplevm" discardcurrent 
 </pre> 

 * To see Snapshot information about a particular VM 
 <pre> 
 VBoxManage snapshot "examplevm" discard "prebackup" 
 </pre> 

 h2. 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: 
 <pre> 
 VBoxManage clonehd /full/path/to/{uuid-of-last-snapshot}.vdi thedisk-full.vdi 
 </pre> 

 So I should clonehd only the last snapshot, not every snapshot from the chain. And it is thousands percent faster. 



 h2. Resources 

 * https://www.virtualbox.org/manual/ch08.html

Back