Your virtual machine's vhd is as it should be, you have no issue. I will try to explain this below.
Hyper-V uses three different types of virtual hard disks:
- Fixed size VHD
- Dynamically expanding VHD
- Differencing VHD
1. Fixed size vhd
A
fixed size VHD is when stored on your host always the same size. If your vm has a 100 GB fixed size VHD it takes 100 GB storage space on your host regardless how much data is actually stored on it. A totally empty 100GB fixed size VHD takes 100 GB on host, a fixed size VHD with 60 GB data stored on it takes the same 100 GB storage space on your host.
If you want your virtual machine to use a fixed size VHD you need to create the VHD first, then attach it to a vm as existing VHD. A fixed size VHD can be created in
New Virtual Hard Disk Wizard (Hyper-V Manager > New > Hard disk):
In wizard select
Fixed size:
Now create a vm with
New Virtual Machine Wizard and use your existing fixed size VHD:
2. Dynamically expanding VHD
The default VHD type in Hyper-V is
dynamically expanding. A dynamically expanding VHD only uses the storage space on host it needs but is allowed to expand (grow) as the need arises. The host system sees the VHD file size as big as it actually is but the guest sees its size as the set VHD maximum disk space. A 100 GB dynamically expanding VHD with only 10 GB data stored on it is for the host a 10 GB VHD file but the guest sees it as a 100 GB HDD with 90% free space.
An example. I have a
Windows 10 Technical Preview vm. When I created it I accepted the default 127 GB VHD size for it and later created another 127 GB VHD attaching it to the same vm. This W10 vm has now two 127 GB virtual hard disks attached to it:
Looking from inside the vm everything is as it should be:
However, if we check these two VHD files from the host, we can see they are only using just under 12 GB and 4 GB storage space on host:
Let's copy a big ISO file to vm and download some additional content on it to see what happens. You can see that the vm sees its hard disks exactly as they were, two 127 GB hard disks, only showing less free space because we have added about 5 GB worth of files:
Looking the same changes on host we can see that the size of the VHD file has been changed because it needed to expand to store the newly added 5 GB:
3. Differencing VHD
Hyper-V uses differencing virtual hard disks to allow
Checkpoints. A Hyper-V Checkpoint is a "snapshot" of the virtual machine state as it was when a checkpoint was created, allowing user to discard all changes later and restore the vm as it was. Read more about Hyper-V checkpoints at our sister site
The Ten Forums:
Hyper-V Checkpoints - Create and Use in Windows 10
When you create a checkpoint of your parent VHD (original VHD where the OS is installed) it keeps record of changes (differences) on your vm which makes it possible to discard every change made since creating the checkpoint. A differencing VHD can have a fixed size VHD or a dynamically expanding VHD as its parent, in virtual machines with several virtual hard disks it can also have (it will have) more than one parent.
VHD type for a differencing VHD cannot be changed nor can it be shrinked or expanded.
Summary:
When you create a VHD in a
New Virtual Machine Wizard, the resulting VHD is by default a dynamically expanding VHD, meaning it only uses as much space on your host (Hyper-V server) HDD as needed, expanding when it needs more space. The
Maximum Disk Space shows how large you allow a dynamically expanding VHD to grow. You can check this easily by launching your vm and checking from its disk management how big the HDD is and compare it to VHD file size on host. The vm HDD always shows the same size but the VHD file on host expands when more space is needed.
Remember the difference between a VHD file on host and a HDD on guest vm; a VHD file on your host is a normal HDD for your vm. A 10 GB VHD file on host can contain a 1 TB HDD for a vm.
Quite a complicated explanation, I hope you got it
.
Kari