Changes

Jump to: navigation, search
Virtual Machine Snapshots with vmrun
== Virtual Machine Snapshots with vmrun ==
 
VMware allows snapshots of virtual machines to be taken, whereby the state of a virtual machine (including the guest operating system) may be saved and then restored at a later date. This feature is particularly useful when performing operating system or application testing. Whilst snapshots may be taken and restored using the VI Web Access interface, it is often quicker and more convenient to use the ''vmrun'' tool. As with other ''vmrun'' commands, the appropriate authentication, host and virtual machine arguments must be provided along with a snapshot name.
 
The following example takes a snapshot (named MySnapshot) of a virtual machine using the ''snapshot'' command:
 
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword snapshot "[Vol1] CentOS 5.2/CentOS 5.2.vmx" MySnapshot
</pre>
 
The corresponding command to revert the virtual machine to the snapshot state uses the ''revertToSnapshot'' command and would read as follows:
 
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword revertToSnapshot "[Vol1] CentOS 5.2/CentOS 5.2.vmx" MySnapshot
</pre>
 
Note that if the virtual machine is running at the time the ''revertToSnapshot'' command is issued, the virtual machine will be placed into the suspended state while the restoration process is performed. To resume the suspended virtual machine using the restored state, it may be resumed using the ''vmrun'' start command as follows:
 
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword start "[Vol1] CentOS 5.2/CentOS 5.2.vmx"
</pre>
 
Finally, an existing snapshot may be deleted using the ''deleteSnapshot'' command:
 
<pre>
vmrun -T server -h https://xps:8333/sdk -u root -p mypassword deleteSnapshot "[Vol1] CentOS 5.2/CentOS 5.2.vmx" MySnapshot
</pre>

Navigation menu