Virtual machine snapshots can be a valuable tool to IT administrators. They provide restore points, which can minimize...
the damage incurred during patch or upgrade malfunction, for example. But using snapshots without understanding what they are and how they work can introduce disk space issues or malfunctioning virtual machines. Follow the links in this guide to learn how to use and benefit from snapshots.
A disk snapshot is a copy of the virtual machine (VM) disk file recorded at a specific time, much like a Windows restore point.The snapshot preserves the original VM disk file by disabling writes to the original disk file – all new writes are made to the snapshot version of the VM.
Snapshots are never larger than the original Virtual Machine Disk Format (VMDK) file. If you have a previous snapshot on a virtual machine and you create a new snapshot, the older snapshot becomes read-only. If you are satisfied with the changes (upgrades, patches) applied to the virtual machine, you can delete, or commit, the snapshots to the original VMDK file. After committing snapshots, you will no longer be able to revert a VM back to a point beyond what's encompassed in the VMDK file.
There are multiple types of snapshot files, and understanding all of them will help you understand the dynamics behind what goes into creating a snapshot.
Creating snapshots with different virtualization platforms
There are two ways to create a snapshot in VMware ESX: you can use the snapshot manager on the VMware Infrastructure Client (VI Client), or you can use the vmware-cmd command line utility.
Creating snapshots with Microsoft Hyper-V is an option from the Hyper-V management console, by right-clicking on the VM you'd like to create a snapshot of. Backing up Hyper-V virtual machines with snapshots, however, isn't as simple as a VSS-aware backup requires the use of a snapshot to complete its work. VMs that have two or more snapshots in place will fail if you try to run them after backing them up.
While no current Linux distro uses the open source Citrix XenServer stack to create a virtual machine snapshot to date, you can still create snapshots by using standard Linux tools.
Using writeable snapshots can help to optimize storage in a VMware environment, as they eliminate the need to make extra copies of data for test and development work. Simply snapshot the production VM and mount it to the test server -- no additional storage is needed until changes are made to the test snapshot.
Snapshot data can be stored in a virtual disk file or in a Storage-area Network logical unit number. If the VM uses virtual disk files, the SAN must support snapshots for the file system (VMFS or NAS). If not, VMware Consolidated Backup (VCB) snapshots must be used.
Because snapshots are software-based, they can have scalability and performance issues. The VCB version uses a dedicated server to connect to the snapshot and back the contents up to tape, which impacts the production disk subsystems. Storage array snapshots, on the other hand, have little impact on performance.
Storage snapshots are not, however, integrated with VMware ESX Server by default. To effectively use storage snapshots, VM-level file consistency is important. When the VM issues a write to disk, it passes through the virtualization layer before it gets to the storage array. For this reason hot snapshots present problems, but both warm and cold snapshots introduce different amounts of downtime.
Another issue occurs when VMs containing snapshots are moved via VMotion to a destination host that can't access the same storage network where the snapshot files are located. In this case, the VM will crash when the VMotion migration is complete, so be careful when changing snapshot file locations from the default in order to save space on the VM's disk. You also won't be able to use VMotion, HA or DRS if your VM is on shared storage and you specify local storage for the snapshots.
When deleting multiple snapshots, there must be ample disk space on the VMFS; best practices recommend at least 25% of the VM's total disk size. This is because all of the snapshots grow in succession before they are deleted. When snapshots are deleted, they are first merged into the previous snapshot and then into the original disk file before they are actually deleted. If the extra disk space is not available to delete snapshots in the usual manner, an option is to delete snapshots one by one. But this method can be tedious.
IT admins who forget to delete snapshots before moving a VM from Workstation to ESX or VMware Server may encounter a problem, as VMware Server has no solution for deleting multiple snapshots (it can only delete the most recent snapshot). It's possible to remove the forgotten snapshots by using a trial version of Workstation to clone a VHD or collapse a snapshot chain back to one VHD file. If using Workstation is not an option, however, contributor Andrew Kutz has written a 20-step how-to that offers a workaround.
During the deletion process, VirtualCenter may report a timed-out message. VirtualCenter, however, has an automatic 15 minute timeout, so for the most part this message can be ignored. To manually check the status of a snapshot deletion, check the data store browser in the VI Client. When the delta file disappears, the snapshots have been deleted.
If you encounter an error and the delta files are still there, there are a few processes you can try. First, you can create a new snapshot and then delete all snapshots after the new one has been created. If that doesn't work, you can clone the VM or the VM's disk file.
Dig Deeper on Virtual server backup and storage