Snapshot enables the administrator to preserve the state of the virtual machine so that it can be returned to the same state repeatedly. For example, if the administrator does some patching or upgrading of the operating system of the virtual machine, snapshots give him the ability to withdraw those changes if any problem occurs during the operation.
Snapshot preserves both the state of virtual machine and data at a specific point in time. State refers to the virtual machine’s powered state, which can be powered on, powered off, or suspended. Data includes the files that make up the virtual machine, including the disks, memory, and other virtual hardware devices like NICs. It is important to understand that snapshots should not be used for backup purposes, as the virtual machine size can increase drastically. Once a snapshot is created, all changes to virtual disks are stored in delta files. As a result, a virtual machine might consume the doubled size on storage if every bit is changed on its virtual disks. If multiple snapshots are created, the most recent snapshot refers to the previous snapshot, also resulting in doubled size. It is advisable to delete snapshots as fast as possible, as the virtual machine’s I/O performance also suffers from the created snapshots.
A virtual machine can have one or more than one snapshots. Each snapshot consists of the following set of files:
- Memory state file (
vmname-snapshot#.vmsn): This file holds the memory state at the time the snapshot was taken. While taking the snapshot, if the administrator captures the memory, the size of this file is equal to the maximum size of the memory of that virtual machine. If the machine’s memory is not captured, the file size is much smaller.
- Disk descriptor file (
vmname-0000#.vmdk): This file is a text file that describes the snapshot and contains relevant information about it.
- Snapshot delta file (
vmname-0000#-delta.vmdk): This file contains the changes to the virtual disk’s data when the snapshot was taken.
- Snapshot list file (
vmname.vmsd): This is the snapshot list file created when the virtual machine is created. It maintains the snapshot information so that it can create a list of snapshots in the vSphere Web Client.
The process of taking snapshots
To take a snapshot, proceed with the following steps:
- To take a snapshot, right-click the virtual machine in the inventory and select Snapshots and Take snapshot.
- In the Take VM Snapshot dialog box, a Name and Description for the snapshot (for example, snapshot before OS patches).
- If you want to have the guest operating system’s memory content included in the snapshot, check Snapshot the virtual machine’s memory. If disabled, the virtual machine will be in powered off state if the snapshot is reverted to.
- If VMware Tools are installed in the guest operating system, it is possible to initialize file system synchronization before creating the snapshot. As a result, all content cached in the file system is written to disk, to ensure that the snapshot contains all relevant changes. To enable this feature, check Quiesce guest file system.
The administrator can take the snapshot when the machine is on, off, or suspended. Integrating virtual machine memory and quiescing the guest file system is only available while the virtual machine is running.
Right-click the virtual machine in the inventory, select snapshot, and click on Snapshot Manager.
In Snapshot Manager, the administrator can do the following tasks:
- Delete: This carries out the task of merging the snapshot data with the parent snapshot, and then removes the selected snapshot.
- Delete all: It merges all the immediate snapshots before the current state and removes all the snapshots.
- Revert to: This enables the administrator to restore or revert back to a particular snapshot. The snapshot that the administrator reverts to becomes the current snapshot.