Many articles have been published about Hyper-V and how to use it, but few dig deep into its features. What's really...
going on below the surface? Sometimes it's something simple; other times it's a chain of complex steps that gives users a glimpse at the brilliance of the developers who make it work.
Knowing which Hyper-V files and folders make up a VM, how to locate them and what functions they perform will give you a leg up to troubleshoot problems when they occur.
Let's start with where Hyper-V files are located and how to navigate to them. VMs and associated files reside in a few default locations, in addition to a designated directory in your setup.
For stand-alone hosts, default files reside in two different locations:
- Configuration files: C:\ProgramData\Microsoft\Windows\Hyper-V
- Virtual Hard Disk (VHD) Files: C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks
For stand-alone Hyper-V servers, it's best to put all VM-associated files into one directory on a different volume, such as a D:\VMs drive. This eases file management and allows you to keep the VM I/O off the drive that houses the OS.
VM files for clustered hosts reside in a different default location. Even though you can separate VM files into different directories or volumes, they're usually stored in the same VM directory with subdirectories. Clusters generally use a type of shared storage called Cluster Shared Volumes (CSV). VMs live in these volumes, and all nodes of the cluster have access to them. Use either Storage Spaces Direct or some sort of storage area network storage connected to Fiber, iSCSI or Server Message Block to create this type of storage.
When using CSVs for your shared cluster storage, Hyper-V creates a mount point on the C:\ drive for each node of the cluster, which is then linked to each of the CSVs. These can be found in the following locations:
If you use something like System Center Configuration Manager to provision VMs, it creates VMs in the following paths:
This location encapsulates VMs in an organized manner (Figure A). I recommend using this location regardless of which method you use to create VMs.
Inside the Virtual Hard Disks folder
Look deeper into the directory structure, specifically the Virtual Hard Disks folder, and you'll find VHD, Hyper-V virtual hard disk (VHDX), automatic virtual hard disk (AVHD), AVHDX, Resilient Change Tracking (RCT) and Modifiable Region Table (MRT) files.
VHD files come in two varieties: .VHD and .VHDX. VHD is the older version of Microsoft's virtual hard disk and has been around since the Virtual Server 2005 days. VHDX files have been around since Windows Server 2012 and provide better performance and fault tolerance than VHD files. These files are VM hard drives and contain all individual files, OSes and so on. Mount these files directly with Disk Management in Windows 7 and higher, or browse and change the content.
AVHD and AVHDX files are used to store all newly written data after an administrator or a backup procedure creates a checkpoint.
RCT files, a new addition to Windows Server 2016 Hyper-V, track changes between backup operations. Instead of backing up the entire VHD(X) file or traversing the whole file, the RCT file tracks changes and directs backup software only to blocks that have changed. This enables faster backups than previous version of Hyper-V and puts the technology on par with VMware Change Block Tracking.
Like RCT files, MRT files aid in tracking changes between backup operations, but they also provide resiliency in the event of a host crash, blue screen of death or even power failure. MRT files ensure data doesn't go missing if something catastrophic happens to a host during a backup.
Inside the Virtual Machines folder
There are two types of Hyper-V files in the Virtual Machines folder: Virtual Machine Configuration (VMCX) files and Virtual Machine Runtime (VMRS) files.
A VMCX file replaces the Extensible Markup Language file found in previous versions of Hyper-V and contains all configuration information for the VM, such as RAM, hard drive, CPU and so on. A VMRS file is similar to the binary file found in previous versions of Hyper-V. A VMRS file contains VM runtime state data and is usually the size of the active RAM used in the VM.
Inside the Snapshot folder
If you take a checkpoint of a VM or create one during a backup, Hyper-V creates additional VMCX and VMRS files to capture the configuration and runtime state of the VM at that specific point in time. This enables a user to roll back to that version of the VM, if necessary.
Inside AVHDS files
The new Shared Virtual Hard Disk Set (AVHDS) is a special VHDX file that's shared between two or more VMs and acts as a serial-attached SCSI disk for VM guest clustering. An admin can store AVHDS files in any location, though they are commonly stored on a Server Message Block cluster using Storages Spaces or on a CSV in the same physical host cluster. VM nodes that share an AVHDS file must have access to the common location where the file is stored.
Understanding what all segments of a Hyper-V installation do, how they work, where they're located and how to access them gives admins insight into performance problems and unresponsive VMs.
In the Hyper-V world, this is equivalent to checking that you've plugged in the power cord. So, whether you check these Hyper-V files while logging in to the host or via a remote Universal Naming Convention path, dig deeper and add these points to your troubleshooting checklist.
Choose the right Hyper-V VHD format for production workloads
Compare and contrast Hyper-V checkpoint types