Hyper-V virtual hard disk types
Hyper-V is a popular type 1 hypervisor. When creating VMs with it, you need to choose what types of virtual hard disk (VHD) to create.
Basically, there are 3 different types of Hyper-V virtual hard disks you can create.
- Fixed size disk
- Dynamically expanding disk
- Differencing disk
They have different advantages, for example, dynamically expanding disks are slower than fixed size disks, and thus they are suitable for different situations.
In this article, I will introduce the pros and cons of these 3 types of Hyper-V virtual hard disk, and make a comparison between them.
What is fixed size disk
A fixed size disk only takes up the space you allocated to it during VM creation.
For example, if you create a 120 GB fixed size disk, it will actually take up 120 GB of your physical storage, regardless of how much data you stored in it.
Disk fragmentation does not easily occur on fixed size disks. Because if you deleted a file on it, it will be marked as write-over so that the newly created file can be stored over it.
- Space Predictability: Preventing unpredictable space shortages by scheduling your disks based on actual needs and physical storage capacity.
- High performance: Not prone to disk fragmentation, resulting in fast speeds and good performance.
- Long Creation Time: It will take long if you create a fixed disk of large size.
- Space Wasted: the spare space cannot be used for other VMs or files.
What is dynamically expanding disk
Dynamically expanding disk is a disk type that is small at creation, but grows as more data is written to the VM.
For example, if you create a 120 GB dynamically expanding disk, it may only take up 40 GB your VM needs at creation, but it will grow as the data written to it afterwards.
- High Space Utilization: Dynamically expanding disk takes up small amount of space at creation, the rest of the space can be used for other purposes.
- Quick Creation: It takes less time at creation since the dynamically expanding disk is small.
- Disk Fragmentation: As the size of the disk continues to change, it causes the host operating system to become increasingly fragmented, and thus degrade the performance.
- Slow Read Rates: The underlying physical spindles have to spend time bouncing from one block to another within the volume to read the required data.
- Offline Risk: Dynamically expanding disks may fill up the available storage and take the VM offline.
What is Differencing disk
Differencing disk is also called child disk, refers to the dynamic volume that’s chained to a parent disk. It only stores the changes made to the parent disk.
Differencing disk is small at creation, and grows as the changed data written to it. If its parent disk is an incompletely expanded dynamically expanding disk, the differencing disk may even grow larger than the parent disk.
- Space Saving: The differencing disk can take up small space as it only stores the changes made to the parent disk.
- Maintains Parent Consistency: Creating a differencing disk makes the parent disk read-only, which helps to maintain the base image consistency.
- Helps Troubleshooting: Differencing disks isolate the changes from the parent disk which helps in troubleshooting.
- Performance Affecting: More differencing disks may result in more I/O reads involved on the parent disk, and have a negative impact on VM performance.
- Short Term Use: Long term use of the differencing disks will lead to steady performance drop and storage problems. Therefore, it is not suitable for use in production environments.
Dynamically expanding disk vs fixed size disk
Now you've known what the dynamically expanding disk and fixed size disk are and their pros and cons. In this part, I will summarize what is the difference between a fixed size virtual disk and a dynamically expanding virtual disk.
Dynamically expanding virtual hard disk vs fixed size virtual disk
|Disk type||Fixed size disk||Dynamically expanding disk|
|Total disk size||fixed||grow as data written|
|Size at creation||larger||smaller|
Why dynamically expanding disks are slower than fixed size disks
Dynamically expanding disks will cause disk fragmentation and require additional processing of disk read and write accesses, resulting in much slower servers. Here is what exactly happens:
In a fixed size disk, all blocks are located at a known location which is linearly addressed, and each block is equally quick accessible if neglecting seek time differences. However, seek times are a fundamental variable when blocks are written many thousands of times per second.
In a dynamically expanding disk, logically sequential blocks are not necessarily close to each other. The two blocks that are supposed to be next to each other on the disk may in fact be at opposite ends on the physical disk, and require a substantial disk head move. There is also additional CPU and RAM required to index all blocks if you used SSD which has negligible seek times.
This additional management requirement may be fine for one or two VMs, but if you have dozens on a busy server, the resources required to handle disk access all add up, as well as the time and performance.
How to choose from Dynamically expanding and fixed-sized disk
As you can see, each disk type has its own advantages and you are advised to choose according to your situation.
- If you have enough storage space, then fixed size disk is the best choice. This type of virtual disk will provide higher performance and faster data writing.
- If you want to make better use of your storage space, then dynamically expanding disk may be more suitable for you. In addition, if you need to quickly create new VMs for testing or development, creating a dynamically expanding disk is also quicker than a fixed disk.
✎Always Remember to Protect Your Hyper-V VMs
Whichever disk type you choose, once you've created a VM, the next thing you need to do is to set up a regular backup schedule to protect the critical VM data. Here I recommend AOMEI Cyber Backup, a free backup solution that can back up multiple VMs regularly with simple steps. More »
Why dynamically expanding disks are slower than fixed size disks, and what's the difference between them? This article introduced the basic information you should know, and help you to make the choice. If you have adequate storage space and you value the VM performance, making fixed-size disks is a better option.