There are three types of virtual hard disks in Hyper-V. Those three types are:
- Fixed size
- Dynamically expanding
I will explain each type with pros and cons in the article below.
Fixed size Disk
When you create a fixed-size virtual hard disk, space is reserved beforehand. Suppose you created a VHDX of 200 GB, then 200GB space will be reserved for you on the hard disk of the host. You may be using 5 or 50 GB out of it, so rest of the space is wasted and this is the real drawback of this virtual hard disk type.
Dynamically Expanding Disk
When you create a dynamically expanding virtual hard disk, initially, just a small space is reserved for you on the host. Suppose you create a 200GB virtual hard disk for your VM, although your VM will look as if it has a 200GB virtual hard disk, but only a small amount of space will be taken up from the hard disk of the host. When the VM starts writing data, the VHD will grow automatically.
In a dynamically expanding virtual disk, your hard disk space is not wasted but your virtual disk may be fragmented (Read more here on fragmentation).
Differencing disks are used in parent-child relationship. Data is written to the child virtual disk keeping the parent disk in read-only mode.
An example could be a sys preped operating system in the parent disk and multiple virtual machines using the child disk. Each VM uses its own differencing disk and writes data in it while the operating system binaries are placed on shared parent disk.
Although differencing disks take less space but if there are more child VHDs, many I/O reads will be involved on the parent VHD which could have negative effects on VM performance.
How to Create a Fixed, Dynamically Expanding and Differencing Virtual Disk using Hyper-V Manager
You can use a Hyper-V to create fixed, dynamically expanding or differencing virtual disk using Hyper-V manager.
Step 1. Open Hyper-V manager.
Step 2. Click New -> Hard Disk.
Step 3. Click Next.
Step 4. Choose the format of the virtual hard disk (VHD or VHDX).
Step 5. Click Next.
Step 6. Choose the type (Fixed size, Dynamically expanding, or Differencing) and then click Next.
Step 7. Provide the name and location to this virtual hard disk.
Step 8. If you have chosen Differencing virtual disk in step 6, choose the parent virtual disk now.
Step 9. Click Next.
Step 10. Choose the size (only if you are using fixed or dynamically expanding).
Step 10. Click Finish.