Table of contents
This post will look at how Hyper-V uses storage in terms of disk space allocation. It will not look specifically at or contrast connectivity or physical platform types.
The Hypervisor
In terms of disk space Hyper-V itself can’t really be distinguished from its management OS. This will use approximately 20 GB, not including a page file. Hyper-V Server 2012 tends to make a reasonably sized page file. In other cases, the operating system will create a default page file based on available physical memory. Since physical computers intended to run hypervisors tend to have high quantities of memory, this may be a much larger size than is actually necessary. We have a post indicating how to check and adjust this.
Aside from what is used, you’ll also need to maintain free space. There are no definite best practices to follow. If you’re going to be backing up the system partition, VSS requires at least 20%. Windows Update patches will occasionally require multiple gigabytes temporarily. You’ll also need to consider antivirus and any other system applications you’ll be installing. Commonly, a modern Windows Server installation is placed on a 40GB partition or greater. This assumes that you won’t be using this partition for anything else, like storing virtual machines.
Virtual Machines
The most obvious storage need for a virtual machine is the VHD files that represent its hard drives (2012 can also use VHDX files; for the purposes of this post, the two types are interchangeable so only .VHD will be talked about). Fixed VHDs are the easiest to account and plan for. They’ll be a tiny bit larger than their allocated size. Dynamic disks will be a little more than their maximum size or less. Differencing disks (whether manually created or snapshots) can grow to fill all available space. If that occurs in a location where VHDs for active virtual machines are stored, Hyper-V will pause them.
You can use the properties of a virtual machine to change the location its snapshots are created so as to reduce the risk of having several virtual machines pause. However, the owning virtual machine will still pause if it has an active differencing disk and its location runs out of space. It can be difficult to merge these if that happens, so be mindful of differencing disk growth. For a manually created differencing disk, you can specify where it will be stored at creation time.
When a machine is saved, its state is held in a .VSV file. This contains state information besides disk and memory. They are variable in size, but typically no more than a few megabytes. They are kept in a subfolder of the “Virtual Machines” folder. The subfolder is named with the unique ID of the VM.
Along with the .VSV, a .BIN file may be present. It is intended to hold the contents of the VM’s RAM while it is in a saved state. In 2008 R2, this file is always present and is the same size of the virtual machine’s system memory. The file is simply idle while the virtual machine is powered on; it is pre-allocated so that its space is guaranteed to be available if needed and for quicker response to a save action. On 2012, if a machine’s “Automatic Saved State” is not “Save State”, then the .BIN file is not created. It is still possible to manually save the state as long as there is enough room for the file.
An .XML file representing the configuration of the virtual machine exists in the root of the configuration location. This file can be viewed but is very sensitive to tampering. Use extreme caution (and backups) if you intend to modify it. This file is approximately 32KB in size.
For each active snapshot (as opposed to a snapshot that has been deleted and is awaiting a merge for its .VHD files), there are matching VSV and BIN files.
A “Planned Virtual Machines” folder exists on a Hyper-V Server 2012 installation. Incoming .XML configurations are placed there while non-cluster migrations are in progress.
Summary
For the most part, planning storage for a Hyper-V virtual machine centers on the VHD files. As density increases, the cumulative effect of the supporting files is also a consideration. These files also have to be moved during migrations, copied during backups, and tracked during replication, so it’s beneficial to know what to expect. It’s also helpful to be able to answer the “what’s this?” type of questions.