Here is where we locate it:
At most, we can expand the virtual disk:
Now if we look at our options again, we see that there is now a third option: Shrink
Note that, while we can indeed shrink the virtual disk, we cannot shrink it to less than its original size (in this case, 48 GB):
Next I will convert the virtual disk from fixed size to dynamically expanding.
Conversion implies the creation of a brand new disk so we need to select a location for the converted disk with sufficient space for the file:
This is the summary of the operation:
After adding files, the size of the disk increases to almost 11 GB:
Here is another perspective:
Now I will delete the files.
In the properties of the C: drive, we see that the amount of used space has decreased to its original size (more or less):
However, the size of the virtual disk does not decrease at all:
Now let's try to compact the virtual disk while the disk is in use:
This is not possible (at least not on the virtual disk with the operating system):
Now I will turn off the virtual machine and attempt the operation again. This time, I am able to compact the virtual disk:
Likewise, we cannot convert a virtual disk when the virtual machine is running (the option does not appear):
But if we turn off the virtual machine, the option does appear:
- We can resize a virtual disk (expand or shrink) if it is in the VHDX format.
- It can be a fixed disk or a dynamically expanding disk.
- However, the virtual disk must be offline.
- We may not be able to shrink the virtual disk below its initial size (in my case, the size of the fixed disk before it was converted to dynamically expanding).
- We can compact a virtual disk of the dynamically expanding type if it is in the VHDX format and offline.