Just like a physical machine, a virtual machine also requires a hard disk to function. In today’s blog post, we’ll discuss what virtual file formats are supported by Hyper-V and their types. We’ll also cover in detail about the different types of VHD/VHDX, and how to choose the right one for your requirements.
What is a VHD?
A VHD is a type of file format for the virtual infrastructure, just like a physical hard disk. It has the functionalities of a typical hard drive but is installed and managed in a virtual setup. It often contains the same partitions and sectors as found on a physical drive, like partitioning and the file system. It can be stored in such a place where the physical host can access it.
Compared to physical disks, VHDs can be created in, added to or removed from a virtual machine much more easily and quickly. They also allow configurations that allow you to use the available physical disk space efficiently.
VHDX is another virtual file format in Hyper-V, and it came in with the release of Windows Server 2012. Before VHDX, Hyper-V virtual hard disks had a capacity of 2TB. VHDX offers a 64TB capacity. They have a 4KB logical sector size which contributes to better performance, and they are designed to be compatible with today’s modern hardware.
Know more: VHD and VHDX disk overview and conversion
Be it a VHD or VHDX, there are basically three types of disks available that you can choose from:
Types of VHD/VHDX
What is a Fixed Disk
A fixed-size VHD simply takes up the entire space that is allotted to it during VM creation. The VHD size does not change when data is created or deleted.
For example, if you create a 127 GB fixed VHD, then it means 127 GB disk space of the host storage will be dedicated for this VHD alone.
The fixed type disk is zeroed out when it is created. This, in turn, leads to better performance as Hyper-V doesn’t have to perform a ‘zero operation’ when the first write to the disk takes place. The disks are zeroed out as a security measure so that any underlying data in the physical storage area cannot be accessed by a disk-scanning tool in the virtual machine.
Disk fragmentation occurs when files are written and deleted over time. When you delete a file, it is marked as write-over. So the next time when a new file is created, it simply writes over the space, and if this file happens to be larger than the existing file, then the remaining portion is written in the next available space. Eventually, you will be left with many files broken up into multiple locations across the hard drive. Thus, the files will be available as non-contiguous clusters, which increases the read time.
When it comes to fixed-size VHDs, disk fragmentation is not a major concern, though it occurs if you manually expand the disk or if the disk is created in an already full volume.
- Fastest among the VHD types
- Better performance for workloads that are sensitive to disk performance
- Not prone to disk fragmentation
- Creating a fixed disk is a time-consuming process
- They do not have dynamic growth
- If the VHD created is too large, there’s no way to re-allocate it any other resource
- Potential for wasted disk space
In most cases, it is recommended to you use fixed disk since it has better resiliency and performance characteristics compared to the other disk types.
What is a Dynamically expanding Disk
This type of disk expands as data is written to it. The virtual hard disk file that is created at first is small, and it grows as and when data is added to it.
This is the default type that’s selected when you create a VHD.
The file starts out very small with a preset maximum size. This file size grows in chunks as data is added, and the file stops growing when the preset maximum size is reached. When creating a dynamic volume, you must still specify the initial disk size, but the host disk usage is based on how much data is actually being stored in that volume.
For example, if you initially create a 127 GB VHD but the virtual machine only requires 40GB, then only 40GB will be consumed from the host physical disk storage, and the disk will grow in size later as data is written to it.
In dynamically expanding disks, disk space is zeroed only as and when data is written to it. Also, these disks require a lot of planning and monitoring, as disk space could easily fill up the datastore and take production loads offline unexpectedly.
Though the obvious issue with dynamic disks seems to be the gradual growth of data, the real issue actually lies with the read speeds. Consider the case where 20 small dynamic virtual hard disks on the same volume are each separately growing a block at a time. They cause fragmentation across volumes. This affects the sequential reads as the underlying physical spindles have to spend time bouncing from one block to another within the volume to read the required data.
- Better usage of physical storage space
- Occupies lesser than 1GB of space initially
- Offers better growth performance
- Easy to copy virtual disk files between machines
- Possibility of disk space filling up the datastore
- Slower read rates
- Prone to disk fragmentation
Dynamic disk types are recommended for cases where storage is a major concern because it offers resiliency in addition to space savings.
What is Differencing Disk
A differencing disk is a virtual hard disk that is basically a dynamic volume that’s chained to a parent disk. They can be configured with a parent-child relationship to form a hierarchy of VHDs.
A differencing/child disk contains block-level data that represents changes to a parent VHD. Each differencing disk can have only one parent, and the parent can be either a fixed, dynamic, or another differencing disk. Hyper-V can merge all the differencing disks back to the parent, thereby destroying the child disks.
The child disks are usually small, however, they can grow up to the size of the root parent. A differencing disk attached to a dynamic parent can outgrow it, if that disk isn’t fully expanded.
This type of VHD is usually intended for VMs that will have a short life, like pooled Virtual Desktop Infrastructure (VDIs), or test labs. A single parent VHD can be created with a generalized OS, and multiple VMs can be provisioned with differencing VHDs. The new VMs use the shared OS from the parent disk to boot. The differencing VHDs start out small and will grow as data is added to them. The parent disk will have multiple input operations as it is the common denominator. This type of pooled operation is not suitable for personal VDI VMs because you cannot inherit the changes and you have to delete and start again.
You can create a differencing disk based on any parent virtual hard disk using PowerShell or Hyper-V Manager. They are usually created during backup operations and deleted immediately once the backup is complete. However, manual creation is also possible, and it might be useful in the case of the above-mentioned scenarios like creating pooled VDI. But, management could be a little more difficult than expected and there are no other tools to aid you.
When differencing disks are used for the long term, there arises steady performance drop and storage problems, hence it is not ideal for use in production servers.
- Helps in keeping the consistency of base image
- Good performance for short-lived machines
- Ability to isolate changes on parent disk, useful for troubleshooting and analysis
- Not suitable for VMs with a long life span
- Unpredictable storage utilization patterns
- Possibility of over-provisioning host storage
- Added complexity when relocating parent disk
While each disk type has its own benefits, it is advisable to choose the disk type based on your specific use case. This way, you can derive the maximum benefit out of it, and make it beneficial for your environment.
When it comes to the production environment, it boils down to the below:
- If performance is of more concern than storage space, then go with Fixed disks
- If storage space is of more concern than performance, then opt for Dynamic disks
- If you’re looking to run a test environment or create pooled VDIs, then go for Differencing disks
Who are we and how can we help you?
Vembu is a backup and disaster recovery solutions provider, and we have been in the market for more than a decade now. Our flagship product – Vembu BDR Suite, is a comprehensive Backup & DR solution designed to protect the across physical (Windows. Linux, Mac), virtual (VMware & Hyper-V) or cloud environments.
To protect your workloads running on Hyper-V, check out our Hyper-V Backup. Using this, you can backup your Hyper-V VMs on the standalone host, cluster, CSV and SMB.
Download Vembu BDR Suite v4.0.1 30-day Free Trial and try it in your environment.Like what you read? Rate us