Tip

Taking advantage of VM snapshots in a virtual desktop environment

With VM snapshots, you can make one desktop VM into many. Just watch out for performance when snapshotting in a virtual desktop environment.

Snapshots of a desktop virtual machine are good for short-term convenience, but they're not a great tool for long-term desktop backup because they can accrue serious performance issues over time.

One of the big reasons administrators use virtual machines (VMs) is because they're labor-saving devices. They save the trouble of having to provision a separate physical system, whether it's for testing software or running actual workloads. One of the most innovative and labor-saving functions available through VMs is snapshotting: making a file-based point-in-time image of a VM's state and using that as a baseline from which to create other changes. The original VM snapshot can be restored at any time.

Why VM snapshots are useful

The most obvious use for snapshots is creating a baseline system that you don't need to re-initialize from scratch every time you want to use it for something new. Take a snapshot of the baseline, do the work you need to do and, when you're done, you can simply discard the snapshot.

Another useful feature is that you can make snapshots from other snapshots. For example, I recently had to test a piece of software in conjunction with five or six different pieces of software, each one of those in turn. Rather than load and unload the programs, I created a VM snapshot with only the original program loaded, then created other snapshots from that one, each of which contained the various other programs I was testing. This meant the test environments were all segregated from each other, and I didn't have to worry about installing and uninstalling software repeatedly on the same system.

Parallel snapshotting also lets you do the same thing with test data. You can take a snapshot of a system with a baseline setup -- say, with a given bit of software installed -- and then populate multiple derived snapshots with different data sets.

How desktop VM snapshots affect performance

The most important thing to keep in mind when using snapshots in a desktop VM scenario, though, is performance.

First off, a virtual desktop isn't the best place to do anything for the sake of performance -- not merely because it's running in a VM, but because there are too many other variables that are hard to control in a desktop environment. Snapshotting complicates performance even further because of I/O usage for the snapshot image.

A snapshot is just a file that contains a list of all the changes made to the file system for the VM. This means that working with the VM requires tracking two sources of I/O: the original disk image (read-only) and the snapshot (read-write). Operations that were fairly swift before may suddenly become quite draggy. Some of this can be alleviated by using solid-state storage, but not everyone can afford that.

More on VM snapshots

Explaining VMware snapshots

How to troubleshoot VMware snapshot problems

Understand how Hyper-V snapshots work

Snapshots can also become a major drag on performance if they get too large. If you use a snapshot for a long period of time, the number of changes accumulated require more and more I/O to keep in sync.

Things also slow down when you apply the changes made in a snapshot back to its source image. This ability is handy if you're testing a bunch of different things in parallel and want to commit one of those sets of changes back to your original image. But the process of committing changes back to the original disk can take minutes to hours, depending on how many changes and how big the VM disk image. Plus, because the commit process is so I/O intensive, any other I/O-dependent processes on that system will run that much more slowly.

For these reasons, it's best to use snapshots as a point-in-time copy of a VM, and not as a way to back up an entire VM.

If you're using Hyper-V as your VM on the desktop, several things about snapshots are worth keeping in mind as well.

First, don't confuse Hyper-V snapshots with Volume Shadow Copy Service snapshots. The latter make block-level copies of data from within an NTFS file system and are used for everything from assisting disk backups to restoring earlier versions of a file on a given system. Hyper-V snapshots, on the other hand, are snapshots of the entire disk image for a VM running under Hyper-V. In essence, the Volume Shadow Copy Service ones run inside Hyper-V snapshots.

Second, snapshots are stored in the same location as the virtual hard disk (VHD) they're being taken from. Some other virtualization systems (VirtualBox, for instance) let you store the snapshot and the VHD in different places, which can speed things up by allowing I/O parallelization.

Dig Deeper on Virtual and remote desktop strategies