A virtual machine snapshot captures the state and data of a virtual machine at the specific time when the snapshot was taken. You grab the virtual disk and memory state when you take a snapshot.
These states are caught in separate files that reside with the VM’s base files. A virtual machine snapshot is an exact copy of the virtual machine and can be utilized for VM migration or building multiple instances of the same VM. It functions pretty much like the standard operating system snapshots.
Also, it can be used for restoring the virtual machine to the former state at which the snapshot was captured.
Defining VMware snapshot
A VMware snapshot, VM snapshot, is a copy of the virtual machine’s disk file (VMDK) at a specifically-given time. Snapshots provide a changelog for the virtual disk and are employed to restore a virtual machine to a precise point in time when a failure or system error occurs.
It is important to note that snapshots do not provide backup; you can only backup your crucial files with a proper third-party backup.
It includes a virtual machine’s power state, and the data consists of all of the files that make up the virtual machine. You can easily use live snapshots to restore a virtual machine to that point. VMware snapshot does not affect the virtual machine itself.
If you operate in an environment where you constantly need to return to a particular VM entity, VM snapshots can allow you to do so without creating multiple VMs.
For example, you can use a VM snapshot as a safe recovery location to upgrade or change existing VM settings and configurations.
You can quickly revert to the saved VM snapshot if something goes wrong. It can also help develop and test environments where you need several virtual machines with similar configurations for testing purposes.
How do backups differ from snapshots?
When using VMware snapshots for backups and recovery, it can be considered against the best practices for using VM snapshots. They do not meet the criteria for adequate backups and recovery points.
The significant difference is that backups are supposed to be completely independent of the original virtual machine that we need to back up. But VM snapshots reside on the same disk space as their parent virtual machine.
Therefore, if the physical infrastructure of the parent virtual machine fails, the snapshot will be lost along with the parent virtual machine.
Snapshots also require a lot of disk space. So, accumulating too many snapshots on the same storage infrastructure can degrade performance.
By character, snapshots are signified to be deleted after a specific time. Users shouldn’t keep them once the need to roll back to the particular point-in-time state is over; for example, you should delete them after successfully performing updates.
If snapshots are preserved longer than advised, they can maintain increasing in size and will eventually begin causing performance problems.
On the other hand, a backup stored individually will remain unchanged and can be utilized to fully restore the base VM files.
All the available snapshots can be located in the Snapshot Manager:
The Snapshot Manager, combined with VMware tools, can secure the virtual machine’s memory from the previous snapshot. Multiple snapshots work on the virtual disk, as a snapshot file system and delta disk file can adhere to the vSphere Web Client as the VMware snapshot preserves virtual network interface cards for snapshot operations.
Components of a snapshot
A VM snapshot file contains all the files accumulated on the storage devices of a virtual machine. Bearing a snapshot assembles files with extensions .vmdk, -delta.vmdk, .vmsd, and .vmsn are stored with the VM base files.
The delta files are kept with the base VMDK file, reserved in read-only mode to preserve its original state. Furthermore, VMSD and VMSN files are stored in the VM directory too. Once you take a snapshot, the original VMDK file with the current disk state are preserved in read-only mode.
Moreover, the guest OS can no longer make changes to it, and a delta or a child disk file called delta.vmdk is created to which the guest OS can write. It holds the current disk state and the state that existed when the last VM snapshot was taken. The delta disk has two files:
- a disk descriptor file
- a flat file called flat.vmdk with raw data
VMware snapshot best practices
Snapshots vs. Backups
Since a virtual machine writes all of the state transitions from the latest snapshot to the delta disk file, a snapshot will lean on the virtual machine’s parent base disk when reverting.
If a corrupted parent base disk erupts, administrators cannot adequately revert to a snapshot as they will not be able to facilitate the disk precisely.
Consequently, it would be best to have independent backups, as virtual machine snapshots alone can’t cover all data loss scenarios.
Snapshot aging for more than three days
The snapshot file grows as the state changes to the latest delta disk file. Therefore, keeping a VMware snapshot for too long will negatively impact the VM’s performance.
An outage may ensue if no free space remains on the datastore because of the fact that the snapshot is growing in size.
Control the number of VM snapshots
The highest supported part in a snapshot chain is 32 snapshots. Nevertheless, VMware recommends not to take more than three snapshots per virtual machine.
Excluding virtual machines from taking snapshots
There will be circumstances where an administrator ought to exclude virtual machines from bringing snapshots due to performance and storage issues.
It would be best to have a paid edition for VMware ESXi to use VMware Snapshot properly. Suppose you try to use them with ESXi free. In that case, you see the following error message:
Error: Can’t create snapshot, current license or ESXi version prohibits the execution of the requested operation.
VMware snapshots are a convenient way to get a moment in time copy of your virtual machines. VMware snapshots should not be used as a primary backup method, as they typically function as a record of changes made; they rely on the original virtual machine to reduce the state of the virtual memory snapshot.
A VMware snapshot is great for testing as they save the virtual machine settings, the state of the virtual disks, and the contents of memory if you choose.