Another post today to our “definition” category, which starts to gain some momentum. The idea behind is to give a basic explanation on VMware technologies and how things work. We always thought that writing technical posts is enough to be successful as a blogger, but we were wrong. Our recent non-technical post What is The Difference between VMware vSphere, ESXi and vCenter is a perfect example shared over 2.2K times through our social media channels. Well, this post will be a little bit technical, but it is for a good reason – to explain What is VMware Snapshot?
Almost all backup software compatible with VMware vSphere uses VMware vSphere Storage APIs for data protection, which triggers a snapshot of a VM to backup running virtual machine (VM). Snapshot technology has evolved over time and the latest version of VMware vSphere 6.5 uses SEsparse (Space efficient) is a default format for all delta disks on the VMFS6 datastores.
Snapshots can also be painful. In the past, snapshots could completely break a VM if things go wrong. Even now, it is not recommended to run production VMs with active snapshots. Snapshots also slow down the VMs execution because the writes occurring are redirected to the VMDK delta disk file (something like “vmname-00001.vmdk”).
- Snapshot – When you take a snapshot, the state of the virtual disk is preserved, which prevents the guest operating system from writing to it (it becomes a read only). It triggers the quiescing of the VM and flushes the disk contents out of the file system cache, via Volume Shadow Copy Service (VSS).
- Delta Disk – VMware snapshot unlocks the files that make up a VM from the file system. When a snapshot is created, each virtual disk receives a snapshot delta file delta or child disk is created. The delta disk represents the difference between the current state of the virtual disk and the state that existed at the time that the previous snapshot was taken. The representation of the delta disk file on the VMFS datastore is a sparse disk.
Sparse disks use the copy-on-write mechanism, in which the virtual disk contains no data until the data is copied there by a write operation. This optimization saves storage space.
Delta disks use different sparse formats depending if your datastores are formatted with VMFS5 or with VMFS6.
Example from the lab showing a VM with two snapshots.
A snapshot preserves the state and data of a virtual machine at a specific point in time, it means that snapshot creates a file which “freezes” the state the VM was during a specific time of the day.
- The state includes the virtual machine’s power state (for example, powered-on, powered-off, suspended).
- The data includes all of the files that make up the virtual machine ( disks, memory, virtual network interface cards….)
A virtual machine provides several operations for creating and managing snapshots and snapshot chains. These operations let you create snapshots, revert to any snapshot in the chain, and remove snapshots. You can create extensive snapshot trees. Additionally, the new VMware vSphere Storage APIs for data protection provide a configurable timeout for creating quiesced snapshots.
Register and Download FREE trial at Runecast :
- Runecast Analyzer for VMware vSphere, SAN, NSX, Horizon, AWS – Register, Download FREE Trial. Best enterprise solution to mitigate service outages, increase security and compliance and especially reduce time in troubleshooting slowdowns, problems and other misconfigurations.
Once registered, you can download the OVA and deploy to your virtual environment running VMware vSphere.
Example from the lab showing a VM with two snapshots. (Datastore view).
New in VMware vSphere 6.5 and VMFS 6
SEsparse (Space efficient) is a default format for all delta disks on the VMFS6 datastores.
Quote from VMware:
SEsparse is a format similar to VMFSsparse with some enhancements. This format is space efficient and supports space reclamation. With space reclamation, blocks that are deleted by the guest OS are marked and commands are issued to the SEsparse layer in the hypervisor to unmap those blocks. This helps to reclaim space allocated by SEsparse once the guest operating system has deleted that data. For more information about space reclamation.
The Snapshot Structure
When a virtual machine snapshot is created, all attached disks are snapshotted simultaneously. So there will be one delta disk per virtual machine disk, per snapshot.
The files on the datastore looks like this (represents a VM with 3 snapshots):
Best Practices for Using VMware Snapshots
- VMware recommends only a maximum of 32 snapshots in a chain. For a better performance, use only 2 to 3 snapshots.
- Do not use a single snapshot for more than 24-72 hours.
- Snapshots are NOT backups.
- The snapshot file is only a change log of the original virtual disk, it creates a place holder disk, virtual_machine-00000x-delta.vmdk, to store data changes since the time the snapshot was created. If the base disks are deleted, the snapshot files are not sufficient to restore a virtual machine.
- Snapshots grow with time – This can cause the snapshot storage location to run out of space and impact the system performance.
- From time to time, make sure that your backup software deletes snapshots. That there are no snapshots left. (Note that I remember battling with Symantec Backup exec back in a time. The product was leaving snapshots behind and the troubleshooting was really painful). Snapshots taken by third party software (through API) may not appear in the Snapshot Manager. Routinely check for snapshots through the command-line (or via a free utility called Snapwatcher for VMware – snapshot detection for VMware infrastructure. Can detect invalid, broken snapshots. Easy to install the app. I have reviewed the enterprise version which can also fix and delete broken snapshots from within the console.)
- DO NOT Increase the virtual machine disk size or virtual RDM when VM has snapshots – Increasing the disk size when snapshots are still available can corrupt snapshots and result in data loss.
Snapshots are cool as such (if I can tell that), but should not be used as backups or you should not have VMs running on snapshots for days and days. To backup VMs there is backup software. You can find plenty of backup software compatible with VMware datacenter virtualization technologies.
Snapshots can negatively affect the performance of a virtual machine. Performance degradation is based on how long the snapshot or snapshot tree is, how deep is the tree, and how much the VM and the guest OS have changed from the time you took the snapshot. Additionally, you might see a longer delay when Powering ON a VM. If your VM has disks larger than 2TB, then snapshot can take much much longer.
So, snapshots yes, but not excessively….
More posts from ESX Virtualization:
- Dedicated vSphere 6.5 Page
- Free Tools Page
- Three Ways to Enable ESXi Shell and Timeout
- How to Migrate Windows Based vCenter to VCSA 6.5 [Lab]
- Upgrade Windows Server 2012R2 AD to Server 2016