Hyper-V includes many fine-grained settings that help to control the behavior of the CPU scheduler for Hyper-V virtual machines, compatibility, and NUMA architecture. With the memory settings, administrators have powerful controls over how Hyper-V memory is provisioned for a virtual machine, how much memory is assigned, and how the memory is allowed to grow or shrink by using dynamic memory assignments.
The next important aspect of virtual infrastructure is Storage. In this final post covering basic Hyper-V virtual machine settings, we will take a look at how to configure basic Hyper-V virtual machine storage resources and settings.
Hyper-V Disk Formats – VHD and VHDX
There are various options that administrators can configure when looking to create or assign storage to a Hyper-V virtual machine. One of the choices that administrators have to make is the choice of the virtual disk format.
There are two Hyper-V disk formats that can be used with a Hyper-V virtual machine. These are the VHD and VHDX disk formats.
The VHD disk format is the legacy virtual disk format that has been around since the days of Microsoft Virtual PC. This was the first type of virtual disk used with Hyper-V when it was released.
However, since the release of Windows Server 2012, Hyper-V administrators have had the VHDX virtual disk format available. There are many advantages of VHDX file format.
Advantages of the VHDX virtual disk format
- Large hard disk support – up to 64 TB
- Better logging
- Disk alignment is built into the disk format for 4K
- Dynamic resizing of disks
- Virtual disk sharing
- Overall better performance than the VHD disk format
A couple of things to mention about the VHDX disk format:
- Generation 2 VMs can only use the VHDX format while Generation 1 VMs can use either VHD or VHDX
- Microsoft Azure still does not support the VHDX disk format
- If using modern versions of Windows Server on-premises, it is generally best to stick with VHDX format at this point due to the number of advantages over the VHD format.
- If mixing in public cloud environments, the disk format will need to be considered due to the current limitations there to VHD disks.
How to convert disks from VHD to VHDX & VHDX to VHD
Using the Hyper-V Manager, you can convert disks from VHD to VHDX and VHDX to VHD, depending on which direction is needed and which use case is needed.
This is accomplished using the Edit Virtual Hard Disk Wizard in Hyper-V Manager.
Select the disk and then choose Convert.
Check out this post for more detailed information: Convert VHD to VHDX File format
Hyper-V Disk Types
There are a couple of different Hyper-V virtual hard disk types to be aware of:
- Fixed size
- Dynamically expanding
Hyper-V Dynamic disk vs Fixed disk
Fixed Size VHD:
According to the Hyper-V Manager Convert Virtual Hard Disk screen –
“The fixed sized disk provides better performance and is recommended for workloads that are sensitive to disk performance. The virtual hard disk file that is created initially uses the size of the virtual hard disk and does not change when data is deleted or added.”
This disk type is essentially thick provisioned “eager-zeroed” disks. The entire disk is zeroed out when you create it initially. This has the best performance since Hyper-V does not have to perform a “zero operation” on the first write to the block on disk.
Dynamically expanding VHD
According to Hyper-V Manager, dynamically expanding disks are –
“This type of disk provides better use of physical storage space. The virtual hard disk file that is created is small initially and changes as data is added”.
Again, to use a more familiar term, these types of disks are essentially “thin provisioned” disks that are not initially zeroed out. Disk space is only zeroed out when data is written. This type of disk allows overprovisioning storage on the physical storage space available.
There are general guidelines to consider when using different disk types.
- Fixed-size disks are a bit faster, although, with today’s flash storage, the zeroing process overhead is extremely minute if even discernable at all. With fixed disks, you always know how much storage you have provisioned and available on a Hyper-V datastore. With dynamically expanding disks, this is not so obvious. Administrators must keep a closer eye on disk space used with dynamically expanding disks as in the case of overprovisioning, disk space could easily fill up an entire datastore resulting in taking production workloads offline unexpectedly.
- On the other hand, dynamically expanding disks allow getting much more capacity out of storage infrastructure. “Thin provisioning” seems to be more the trend of today’s storage architecture with extremely fast flash storage becoming much more commonplace.
Configure Basic Hyper-V Virtual Machine Storage Settings
Let’s take a look at some of the basic storage settings found in the properties of a Hyper-V virtual machine that are configurable and allow tweaking virtual machine storage to meet the needs of the use case.
Under the settings for a Hyper-V virtual machine, under the storage controller, you will see the Hard Drive defined for the Hyper-V virtual machine.
Looking in the right pane,
- The first section (Hard Drive) you will see is the SCSI controller section. This allows defining which controller a specific hard disk is assigned to. If you have multiple controllers, different disks can be assigned to different controllers, etc. In the Media section, you choose either virtual hard disk or physical hard disk.
- In the Virtual hard disk section, you can create a new disk, edit a disk (convert, etc), inspect, or Browse to use a specific hard disk that has already been created.
- Finally, in the last section, you can Remove the virtual disk altogether.
Microsoft Hyper-V provides a powerful platform on which to run today’s business-critical production workloads. It allows configuring numerous aspects of the CPU, memory, and storage to tweak the performance, capacity, and scale of virtual resources running on the physical Hyper-V hosts. This allows squeezing much more efficiency out of the hardware hosts running the virtual resources.
As seen in this post, the storage configuration of the Hyper-V virtual machine contains many aspects for consideration. The VHD and VHDX disk formats each have consideration points that may lend to their use. While VHDX is the format of the future with Hyper-V, Azure public cloud workloads are still not running on the new format and require the VHD format.
While VHD formatted disks can be used by either generation 1 or generation 2, VHDX formatted disks require the use of generation 2 virtual machines, so this will be a consideration. Fixed and dynamically expanding disk types each have their advantages and disadvantages. However, the dynamically expanding or thin provisioned disk is certainly trending in popularity with flash storage and the ability to effectively overprovision virtual storage.
By using these and other storage features found in Hyper-V, organizations can certainly create high performance, large scale, and large capacity virtual environments that lend themselves to running powerful production systems.