When considering the anatomy of a Hyper-V virtual machine, one of the important parts to talk about is virtual hard disks. Virtual disks are encapsulation special file formats that provide storage space for virtual machines on platforms. Just like physical disks, they have a structure, partition structure and file system. While classifying virtual disks in the Hyper-V world: format and type (type). Before moving on to virtual disk types, it is necessary to understand virtual disk formats.
Hyper-V Virtual Disk Formats
They are file formats used by virtual machines as storage space and located on real physical disks. Although they vary according to the virtual disk type, they consist of a combination of structural sections such as header, block allocation table, data blocks, footer.
-
VHD Format
In the past, a single virtual disk format was included in Windows Server 2008 Hyper-V and Windows Server 2008 R2 Hyper-V.
The VHD (Virtual Hard Disk) virtual disk format was developed by the Connectix company in 2003 and was later used for virtual machines running on Microsoft Virtual PC, Virtual Server and later on Hyper-V platforms with Microsoft’s acquisition. You can see uses related to VHDs for virtualisation and in various versions of Windows and Windows Server.
It is possible to easily recognize VHD formatted virtual disks from .vhd extensions. It can only be hosted on the NTFS file system and can provide a maximum capacity of up to 2TB.
-
VHDX Format
With Windows Server 2012, a new virtual disk format was included in the Hyper-V platform. VHDX can also be called the new version of the VHD format. VHDXs are built for today’s demanding workloads. The most distinctive feature compared to VHDs is that they can provide more storage space. VHDX can expand up to 64TB. You can recognize the VHDX format from the .vhdx extension. Thanks to its logging mechanism, it is more resistant to breakdowns that may occur in unexpected shutdown situations such as power failure. It has the ability to correct its own structure in error situations. It can keep custom metadata when needed. It supports a larger block size and 4KB logical sectors. It is more performant than VHDs, especially considering the dynamically expanding virtual disk type. You can also describe it as an evolution of the VHD format. The VHDX format is available as of Windows Server 2012 Hyper-V and comes as the default virtual disk format.
If you want, you can create both VHD and VHDX format virtual disks on the same platform and connect them to virtual machines. It is possible to use two different formats even on the same virtual machine, but if your Hyper-V platform supports the VHDX format, you should definitely choose the VHDX format for your virtual machines.
Hyper-V Virtual Disk Types
VHD and VHDX formats contain three types of virtual disks: Fixed, Dynamic and Differential. Each type of virtual disk has its own characteristics. They are used for various purposes.
-
Fixed Size Virtual Disks
Virtual disks created as a fixed-size disk type reserve the specified capacity on the physical storage area in the first place, even if there is no data in them yet. It is clear from the very beginning in which sector range the data to be written into such virtual disks will be located on the physical disk. In this way, they offer more performance storage access than other types. Although the difference between Dynamically Expanding disks has been significantly narrowed with the VHDX format, Fixed Size virtual disks are still the most performing virtual disk type recommended on the Hyper-V platform.
For example, when yo
u want to create a Fixed Size VHDX with a 4TB capacity that does not contain any data yet, you will need at least 4TB of free space on the physical disk layer where the .vhdx file will be located. During the process of creating a Fixed Size virtual disk, physical sectors are reserved. At the end of the process, a 4TB VHDX file is created on the physical disk.
- The initial creation process takes longer than other types.
- Recommended for intense disc activities. It is more performant than other virtual disk types.
- The VHDX file size does not change as data is written to or deleted from Fixed-size vhdx.
- In our opinion, the biggest disadvantage is that it makes the use of physical storage space inefficient. It also reserves the storage space not yet used by the virtual machine for the virtual machine. It is controlled because it eliminates follow-up situations such as physical storage overflow due to unplanned expansion of virtual disks.
- Especially at the platform level, it can seriously inflate the backup size and cause you to review your backup investment. For example, if you initially create a fixed size vhdx that needs 150GB capacity and is expected to expand to 300GB in 6 months, you will have backed up for a long time while taking a host-level backup. This partition without data both consumes backup space and prolongs the backup time. Therefore, if you are using fixed-size vhdxs, keep the initial capacities low, but make sure to follow the volume sizes in case the disk becomes full in the virtual operating system. Alternatively, you can consider taking a backup from within the virtual operating system. This method is usually used for application backup.
- You can easily extend a fixed size vhdx while the virtual machine is running. Note that there must be enough free space on the physical disk at this time. Otherwise, it cannot expand.
- Although it depends on the structure, fixed-size vhdx’s are usually high-size files. When replicating, moving to a different area, or replicating to DRC with Hyper-V Replica, for example, space-consuming areas will be created.
- Fixed-size virtual disks were the only officially supported virtual disk type for many important workloads such as Exchange Server, SQL Server, up to certain Hyper-V versions that can only use the VHD format. While this has gone away with Windows Server 2012 Hyper-V, it’s always a good idea to check the disk types the workload supports or recommends.
-
Dynamically Expanding Virtual Disks
The dynamically expanding virtual disk type does not reserve the specified capacity at the time of creation. Over time, it can expand to the maximum size it can reach as data is written into it. Usually, the areas where the data will take place on the physical disk are uncertain and scattered, as the write operation will occur at random times. Although this effect has been largely eliminated with the VHDX format, it still lags behind Fixed Size VHDX by nature. But it still performs well enough and is officially supported by many workloads.
When you create a “Dynamically Expanding VHDX” with a capacity of 4TB that does not contain any data yet, the size of the “.vhdx” file is around 3-4 Mb. At this stage, physical disk capacity is technically irrelevant. However, this vhdx file grows as data is written into it. It can expand up to 4TB for the example you set at the beginning. At this point, it needs a physical space to expand.
- The creation time is very short. For example, we can say 1-2 seconds.
- It is generally recommended for less intense disk activities and is also supported for live use in new releases.
- Dynamically Expanding vhdx files expand as data is written. However, data does not shrink as it is deleted. Therefore, it is necessary to apply the Optimize-VHD process to shrink “Dynamically Expanding” vhdx’s that have significantly deleted data. For example, a “Dynamically Expanding” virtual disk with a maximum size of 500GB contains 200GB of data. The size of the vhdx file is also about 200GB. When you write another 100GB of data into the virtual disk, the size of the vhdx file reaches approximately 300GB. Then, when you delete 100GB of data, the size of the vhdx file on the physical disk cannot be reduced to 200GB, even though the space used for the relevant volume is 200GB when viewed from within the virtual operating system. It still takes up 300GB of space. As a solution, it is necessary to apply Optimize-VHD at certain times.
- It helps you use physical storage more efficiently. If they grow unplanned, there is a possibility that they will overflow the physical storage area and suddenly stop all virtual machines running in it. Therefore, the maximum capacities of “Dynamically Expanding” virtual disks should be determined well and the physical storage layer should be monitored against sudden expansions. You can use the “Storage Overcommitment” feature of Get-HypervReport.ps1 to track this job.
- The VHDX file size of this type of virtual disk is usually smaller than Fixed Size VHDX. It takes less space during the host-level backup and will likely be backed up in less time.
- In Windows Server 2012 Hyper-V and later, nearly all major workloads are officially supported on dynamically expanding vhdx.
-
Differentiating Virtual Disks
Differential virtual disks are a type of virtual disk used in various scenarios only for differential purposes. They work with the parent-Child relationship. This type of virtual disk absolutely needs a master virtual disk (parent vhdx) to run. The write characteristic to the physical disk is almost the same as for Dynamically Expanding virtual disks. You can often see this virtual disk type in VDI scenarios.
For example, you created a dynamically expanding vhdx loaded with operating systems and applications. Think of it as a gold image and you have 5 different people you want to use the same image. Copying the VHDX file to 5 different points and connecting it to 5 different virtual machines can be one of the options. But after connecting multiple differencing vhdx to a single parent vhdx, assigning them to virtual machines is also a very good option. The data modified by each virtual machine user is kept in the differencing vhdx connected to that virtual machine. Thus, the parent vhdx content in the background is always preserved. In addition, you will eliminate the storage space consumption that will occur when you copy 5 VHDX.
- It needs a parent vhdx to run.
- The creation time is very short.
- More than one differencing vhdx can be connected to a parent vhdx.
- It is generally used for less intense disk activities and VDI scenarios.
- It has Dynamically Expanding characteristics in many ways.
- Not recommended for systems with heavy disk activity and critical workloads.
Note: The correct configuration of the physical storage layer where the virtual disks are located is very important for performance virtual disk activities.