Hyper-V is Microsoft's virtualization technology that has been built into Windows Server 2008 and later versions. With Hyper-V, you can consolidate workloads to reduce server sprawl and make more efficient use of your hardware resources.
Instead of having a separate server for each application, there are a number of virtual machines running on a single high-powered Hyper-V host.
But before jumping on the server-consolidation bandwagon, you’ll need to make some decisions. One of the most important involves the kind of virtual disks each virtual machine will use in an environment.
Here are some advantages and disadvantages to the different types of virtual disks and virtual disk formats supported by Hyper-V for production environments.
A dynamically expanding virtual disk is one that starts small and then grows to meet the needs of the virtual machine's guest operating system. When a new dynamically expanding virtual disk is created, it contains no data and has only a small header. As data is written to the virtual disk — for example, as the guest is being installed — the virtual disk grows in size to accommodate the data. But it can only grow so much.
That's because you have to specify a value for maximum size when a dynamically expanding virtual disk is created. In Hyper-V on Windows Server 2008 and Windows Server 2008 R2, the default size for a dynamically expanding virtual disk is 127 gigabytes, and the maximum size is 2,040 gigabytes. If the virtual disk grows to this size and the guest tries to write more data to it, the virtual machine will crash.
In terms of advantages, dynamically expanding virtual disks have flexibility, because they allow "thin provisioning" of virtual machine storage rather than allocating it in full, up front. They also enable rapid provisioning of storage, since it takes almost no time to create a new dynamically expanding virtual disk. This makes them ideal for test environments where there’s a need to quickly spin-up new virtual machines for testing or development purposes.
But such flexibility also has a downside, particularly in a production environment. Consider a scenario where five virtual machines are running on a host that has 2 terabytes of hard-disk storage available for storing virtual machine files. For maximum flexibility, you have configured each virtual machine's virtual disk to the maximum size of 2,040GB and created a single-disk volume of 2,040GB on each virtual disk.
Unfortunately, one of the guest’s applications goes awry and keeps writing files to the virtual disk, causing the virtual disk to grow until it reaches its maximum size, whereupon that single virtual disk takes up all available space on the 2TB host physical drive. At that point, the host chokes, and all the virtual machines freeze up.
The key to using dynamically expanding virtual disks in a production environment is planning the storage requirements carefully, so the host isn’t unexpectedly overloaded.
A fixed-size virtual disk, the exact opposite of a dynamically expanding virtual disk, must have the full amount of physical storage space necessary provisioned up front. This means a 127GB fixed-size virtual disk actually occupies 127GB of physical storage space on the host's hard drive, even when the virtual disk has no data stored on it. Compare that with a 127GB dynamically expanding virtual disk, which, when it is created, only occupies about 2MB of space on the host's drive.
There are some advantages to using fixed-size virtual disks, even though they take up so much host storage when they are empty. First, predictability: By creating only fixed-size virtual disks for virtual machines, you can be sure you won't run out of storage unexpectedly on the host. Second, reliability: If a power failure hits the data center and affects the host, any dynamically expanding virtual disks in use can become inconsistent, causing their virtual machines to fail.
One of the downsides of fixed-size virtual disks is that if they are underutilized, physical storage space can be wasted on the host. Thin provisioning using dynamically expanding virtual disks can help organizations better utilize limited physical storage on the host, provided the virtual disk storage requirements are planned carefully.
Another downside of fixed-size virtual disks is that, because of their larger size, they can be slower to migrate and back up than dynamically expanding virtual disks. Fixed-size virtual disks are also much slower to create than dynamically expanding disks, although this was significantly improved in Windows Server 2008 R2.
Since the release of Windows Server 2008 R2, the performance of both dynamically expanding and fixed-size virtual disks has been essentially on a par with each other. And since Windows Server 2008 R2, both types of virtual disks are fully supported in production environments.
Figure 1: Pros and cons of dynamically expanding vs. fixed-size virtual disks.
Beginning with Windows Server 2012, you'll also have another decision to make when you create a new virtual disk: whether to use the legacy virtual hard disk (VHD) format or the new VHDX format.
Here are the four main advantages of using the new format:
When you create a new virtual disk in Hyper-V on Windows Server 2012, the New Virtual Hard Disk Wizard defaults to using VHDX instead of VHD, so you can take advantage of the benefits listed above. The only reason you might want to use the legacy VHD format is if you want to migrate the virtual machines to a down-level host running Windows Server 2008 R2. The Wizard also defaults to creating the new virtual disk as a dynamically expanding one, unless you choose otherwise.
Figure 2: Creating a new virtual disk using the VHDX format in Windows Server 2012.
Whatever choices you make when planning virtual machine storage, be sure to plan ahead and make your decisions based on the needs of your particular environment.