Rick Vanover breaks down the anatomy of a Hyper-V virtual machine.
If you’ve ever worked with Hyper-V, you may know that a virtual machine is made up of a few files and some configuration on the host. Those files encapsulate the operation system installed on the virtual machine, as well as the applications installed on that operating system.
But how do those files look on the host? Let’s break down the anatomy of a Hyper-V VM. The first area to look at on a Hyper-V server is the settings screen for the host. This can be done either locally (in the case of Windows Server 2008/2012, as a full install with the Hyper-V role) or remotely with Hyper-V Manager. Figure A below shows the Hyper-V Settings for a ThinkServer RD630 host running Windows Server 2012 with Hyper-V:
The key settings in this path are the Virtual Hard Disks path (Default location is C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks) and the Virtual Machines path (Default location is C:\ProgramData\Microsoft\Windows\Hyper-V), which are the first two options in the settings screen. These options are global options, meaning each host will have new virtual machines created to this setting. It’s also important to note that when you create a virtual machine, you have the option to specify where the virtual disks go (the first option in the figure above) but not where the virtual machine settings go.
It’s pretty clear what goes in the Virtual hard Disks folder: VHD and VHDX virtual disk files. The VHDX disk format was introduced in Windows Server 2012 and supports disk geometry up to 64 TB for a virtual machine. The VHD format, supported with all versions of Hyper-V goes up to 2 TB.
The second path in the Hyper-V settings is a very complicated path, having additional configuration elements for the virtual machines. This default path on the ThinkServer RD630 is shown in Figure B below:
Figure BIt’s important to note that this path contains .XML files, ID folders for each virtual machine, and inside of there .BIN and .VSV files for the virtual machines:
- The .XML file contains the configuration of the virtual machine.
- The .BIN file has the memory of a VM from a snapshot (and the disk differences, if present, would be a .AVHD file).
- The .VSV file is the saved state of the virtual machine.
These files in these various locations compose the virtual machine in regards to its position on the host. If you need to move a virtual machine, it’s important to not just pick up .VHD/.VHDX files and copy, paste or move them, but to move them in a manner that takes care of all of these components. This can be done via the Hyper-V Manager interface with the migration tool or by leveraging a backup tool, replication engine, or System Center Virtual Machine Manager.
When you deploy a Hyper-V host, it’s a good idea to change the default settings. The host I have in this example is only connected to local storage, but if there is a shared storage resource or cluster configuration; the C:\ drive isn’t the right place.
Have you had to manipulate Hyper-V files? What tips have you learned along the way? Share your comments below.