As you probably know, starting Windows Server 2012 it’s possible made hot shrink of VHDX disks, also for Operating System in case you have configured the virtual machine in Generation 2. For those that don’t know what is it Shrink, is the possibility to reduce the volume space to optimize resource, in particular when there is an over-dimension.
Sometime can happen that this operation not working fine. In my case I’ve a virtual machine, based on Windows Server 2016, with 26GB occupied, as showed in figure 1, but the VHDX file was over 70GB, as showed in figure 2.
Figure 1 – Virtual Volume
Figure 2 – VHDX File
I tried the procedure many times without success, checked the procedure twice. What happened? Probably there was some block locked at the end of VHDX, that deny the reallocation and the right shrink to optimize the space. To resolve the issue, I mounted the VHDX from my hypervisor, in Read-Only, as showed in figure 3.
Figure 3 – VHDX Mount
After the dismount, I re-run the Shrink and the result is the right one, as showed in figure 4.
Figure 4 – VHDX After Shrink