How Hyper-V Snapshots Work

How do Hyper-V snapshots work?

Files are flexible, and this is why snapshots can be made of virtual machines – pass-through disks do not support snapshots. The default location for storing a snapshot is configured in the virtual machine settings. By default, the snapshots are stored in subfolder of the virtual machine’s folder called Snapshots. You can change this setting and you can move snapshots using Live Storage Migration.

The configuration of the virtual machine is stored in an XML. The contained settings are copied into an XML file in the Snapshots folder.  The running state of the virtual machine is also stored using BIN and VSV files.

Each virtual hard disk of the virtual machine is also treated by the snapshot.  This is done using a special kind of differential virtual hard disk called the advanced virtual hard disk (AVHD):

  • Each VHD file will become a parent to an AVHD file. The virtual machine will start using the AVHD file for reads and writes after the snapshot, and the VHD file for reads older than the snapshot.
  • Each VHDX file will become a parent to an AVHDX file. The virtual machine will start using the AVHDX file for reads and writes after the snapshot, and the VHDX file for reads older than the snapshot.

A virtual machine can be sent back in time by applying the snapshot – that is, by erasing the contents of the AVHD/X files. A snapshot can be deleted by merging the AVHD/X back into their parent VHD/X files.

Sponsored Content

What is “Inside Microsoft Teams”?

“Inside Microsoft Teams” is a webcast series, now in Season 4 for IT pros hosted by Microsoft Product Manager, Stephen Rose. Stephen & his guests comprised of customers, partners, and real-world experts share best practices of planning, deploying, adopting, managing, and securing Teams. You can watch any episode at your convenience, find resources, blogs, reviews of accessories certified for Teams, bonus clips, and information regarding upcoming live broadcasts. Our next episode, “Polaris Inc., and Microsoft Teams- Reinventing how we work and play” will be airing on Oct. 28th from 10-11am PST.

Hyper-V snapshots

Aren’t Snapshots Dangerous?

In one word: Yes – but all powerful tools can be dangerous if misused. You must ensure that the guest applications in the virtual machine support snapshots and you must understand that you can delete data by applying a snapshot to a virtual machine.

Like with differential virtual hard disks, a snapshot should not be a short-term solution. Once created, all writes will go into the VHD/X files. This can lead to unplanned storage consumption. The physical LUN that stores virtual machines can fill. If this happens, Hyper-V will protect virtual machines that are stored on that LUN by pausing them.

There are several deadly mistakes that one can make with snapshots:

  • Swap the parent VHD/X files: There is a link between the AVHD/X and the VHD/X file. Do not attempt to break and recreate this link.
  • Delete the VHD/X files: Data older than the snapshot, such as the guest operating system, are stored in the parent disks. Do not delete the virtual hard disks.
  • Delete the AVHD/X files: Doing this will delete all the data of the virtual machine since the snapshot was created. Do not do this.
  • Leave a snapshot in place for a long time: Differential disks, and therefore AVHD/X files, is intended for short-term usage. Performance will degrade over time, and the files will continue to grow over time.

The final issue was resolved in Windows Server 2012 Hyper-V. In versions of Hyper-V, deleting a snapshot was not enough – you also needed to shut down the virtual machine to allow Hyper-V to merge the AVHD/X files back into the parent VHD/X files. Live snapshot merging is a feature of Windows 8 Client Hyper-V and Windows Server 2012 Hyper-V. The merge may not be immediate, but it will happen within a few minutes of the snapshot being deleted, and it will happen without shutting down the virtual machine.


Related Topics:

Aidan Finn, Microsoft Most Valuable Professional (MVP), has been working in IT since 1996. He has worked as a consultant and administrator for the likes of Innofactor Norway, Amdahl DMR, Fujitsu, Barclays and Hypo Real Estate Bank International where he dealt with large and complex IT infrastructures and MicroWarehouse Ltd. where he worked with Microsoft partners in the small/medium business space.
External Sharing and Guest User Access in Microsoft 365 and Teams

This eBook will dive into policy considerations you need to make when creating and managing guest user access to your Teams network, as well as the different layers of guest access and the common challenges that accompany a more complicated Microsoft 365 infrastructure.

You will learn:

  • Who should be allowed to be invited as a guest?
  • What type of guests should be able to access files in SharePoint and OneDrive?
  • How should guests be offboarded?
  • How should you determine who has access to sensitive information in your environment?

Sponsored by:

Live Webinar: Active Directory Security: What Needs Immediate Priority!Live on Tuesday, October 12th at 1 PM ET

Attacks on Active Directory are at an all-time high. Companies that are not taking heed are being punished, both monetarily and with loss of production.

In this webinar, you will learn:

  • How to prioritize vulnerability management
  • What attackers are leveraging to breach organizations
  • Where Active Directory security needs immediate attention
  • Overall strategy to secure your environment and keep it secured

Sponsored by: