When most of us deploy a Hyper-V VM, we give thought to the location of the virtual disk file as it can make a big difference to the storage situation of a host. But did you know that Hyper-V VMs have a lot more than just the virtual disk file? Sure, the virtual disk file can get you in trouble if a lot of VMs are on a host and the C:\ drive fills up. But, the other files of the VM are very important as well. Let’s break down the anatomy of the Hyper-V file format.
Hyper-V XML file
The XML file is the most interesting of the virtual machine file types. The XML file truly defines the VM to the Hyper-V host. The XML file is unique for each VM but also contains additional information, such as if where any VM snapshots are present. By default, Hyper-V Generation 2 VMs on Windows Server 2012 R2 the XML files in this path: C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines and a corresponding folder is created. While most humans make virtual machine names like “VM1” or “PROD-EMAIL”, Hyper-V creates the XML file based on the GUID (Globally Unique Identifier) of the Hyper-V VM object.
You can open each XML file to determine which VM it is referring to, just be careful to not make any changes to it. Internet Explorer on both client and server operating systems is a good and safe way to do this task. Look for the <name type="string"> section of the file.
The Hyper-V BIN file
The file contains the memory of a VM and is located inside the GUID folder mentioned above. If the VM is powered off, there will be no BIN file present. This file is equal to the size of the VM’s memory provisioning in Hyper-V Manager, so this can be a place to look if C:\ drive space on the host is getting low.
The Hyper-V VSV file
Also in the GUID folder, this file contains the state of the devices of the VM. Like the BIN file, if the VM is powered off this file will not be present.
The VHD and VHDX file
The VHD and VHDX file are the virtual disk files associated with the VM and are connected to the storage controllers of the VM. The VHDX format, which is new for Windows Server 2012 VMs can go up to 64 TB. The default size is 127 GB and is dynamically expanding (or thin provisioned), meaning it will only consume the size that is actually used. If the full amount is to be reserved, it is referred to as a fixed size disk. These are the most considerable components, from a storage capacity and performance perspective, of a Hyper-V VM. A VM can have multiple VHD and VHDX files. The VHD and VHDX files can be in different locations, and by default are located in C:\Users\Public\Documents\Hyper-V\Virtual hard disks on Windows Server 2012 R2 with Hyper-V.
The Hyper-V AVHD file
If a VM has a snapshot, the AVHD file will appear. This functions as a differencing disk coordinator for the snapshot mechanism by Hyper-V. The AVHD file will be created by default in the same path that the VHD or VHDX file is located. So if a VM has multiple VHD or VHDX files located in different paths, this can be a complicated map of paths and files.
Hyper-V Storage is more than VHDX files!
As you can see, it’s important to know where the Hyper-V VM files exist. And more importantly, what each of the Hyper-V file extensions does. This makes a difference not just to how you provision storage on the Hyper-V host, but also how you manage, backup and migrate the Hyper-V VMs. What are some of your best practices for working with Hyper-V VM files? Have you ever forgotten a file? Share your experiences below.