Petri

Hyper-V Snapshots: What, When, and Why

What is a Hyper-V snapshot?

Simply put, a Hyper-V snapshot allows you to capture a virtual machine as it was at that time (configuration, processor, memory, and virtual hard disk content), make changes to the virtual machine, and optionally restore the virtual machine to the previous snapshot. But let’s dig a little deeper.

Sponsored

Confusion about Snapshots

The term “snapshot” is overused in the computer room. Here’s how they break down.

  • Hyper-V snapshots: Generally, this is the snapshot that people mean when discussing virtualization.
  • SAN snapshots: to image a LUN
  • Volume Shadow Copy Service (VSS) snapshots: to create an application consistent backup of a virtual machine, file system, and applications such as SQL Server

To add to the confusion, System Center – Virtual Machine Manager has historically referred to a Hyper-V snapshot as a “checkpoint”. Meanwhile Hyper-V uses “checkpoint” as a verb. For example, “one will checkpoint a virtual machine to create a Hyper-V snapshot.”

Sponsored

Why use Snapshots?

Snapshots are a useful tool because they can allow administrators to send virtual machines “back in time.” We can undo changes to those virtual machines since the snapshot was taken. This can be useful in many scenarios.

  • You want to perform a complicated upgrade to an application in a virtual machine and want a quick way to roll back the changes if something goes wrong.
  • The company is building a demo or class lab and a quick way is needed to reset the virtual machines to their starting point.
  • You are testing software and need to repeat a set of tests very quickly without re-deploying virtual machines.

Note that some other features of Hyper-V may also use snapshots. Hyper-V Replica will use snapshots for the replica virtual machines in the secondary site if you choose to retain historical copies of the virtual machines.

Are Hyper-V Snapshots supported in production?

Contrary to some commentators over the years, Hyper-V supports the use of snapshots in production. But you should not blindly use something just because you can – you need to educate yourself about how the feature works and in what scenarios it works well.

Remember, when you roll a virtual machine back in time, you are undoing changes to that virtual machine. Imagine this situation:

  1. A SQL Server virtual machine must be patched.
  2. You create a snapshot of the virtual machine.
  3. Patches are installed to the virtual machine.
  4. Sometime later the patches are found to be faulty.
  5. You apply the previous snapshot to the virtual machine.

Three things will happen as a result:

  • The virtual machine is restore exactly to how it was when the snapshot was created and this resolves the problem.
  • Any data that was modified or stored in the database is lost. That’s because the virtual machine is restored exactly to how it was when the snapshot was created.
  • You will be fired for losing hours of company business.

 

Sponsored

Hyper-V snapshots are not necessarily supported by the products that you install in virtual machines so you should always check with the application vendor for support. In fact, some products will break!

Note: Restoring a virtual machine domain controller from any kind of snapshot can cause a USN roll back that breaks Active Directory. This is resolved with Windows Server 2012 domain controllers that are running on GenerationID-aware virtualization such as Windows Server 2012 Hyper-V and vSphere 5.1 (or later).

You must be selective about your usage of Hyper-V. This is why some engineers disable snapshot functionality when they enable self-service or delegated administration.

Tagged , , , ,

Sponsored

Join The Conversation

Sponsors

Sponsors