Windows Server 2012, introduces the VHDX format for virtual hard disks, which among it’s new features, allows resizing without the need of third party tools. In this post I’ll show how to resize a disk using the Windows Disk Management utility and Hyper-V Manager.
In my case, I used this procedure to solve the VHD_BOOT_HOST_VOLUME_NOT_ENOUGH_SPACE error when booting Windows 8 from a virtual hard disk. Dynamically expanding disks can be tricky for booting because they require enough space in the disk where the VHDX is stored to allow it to expand to its full size. In these cases, following this procedure to shrinking the VHDX so that it’s full size fits in your drive will solve the issue.
Note: A dynamically expanding virtual hard disk is one in which the size of the .vhdx file grows as data is written to the virtual hard disk. When you create a dynamically expanding virtual hard disk, you specify a maximum file size. This size restricts how large the disk can become.
To shrink a VHDX, the disc must have un-partitioned space, so first, you need to resize one of the VHDX partitions.
1. Attach the VHD you want to resize.
2. Shrink the primary volume of the disk.
Tip: If you want to free more shrinkable space, try defragmenting the VHDX disk.
2. Detach the VHD.
3. Now open Hyper-v Manager and choose Edit Disk.
4. Locate the disk and select the Shrink option.
5. Wait till the operation completes. To validate that the shrink has worked as expected you can use the Inspect Disk option from Hyper-V Manager.