Shrinking VHDX partion that held SQLserver DB

John Lenz 1,551 Reputation points

Hyper-V Server2012R2 LongWSUS
Role was WSUS with WID
Role removed and db moved to SQLServer (Hyper-V) instance

I am trying to free up VHD space on LongWSUS. I know it is a 2 part process starting with Shrink Volume within LongWSUS. I am getting an inconsistent read on what can shrink. I am wondering if some of the space was the old WSUS SQL db (WID) that is not released.

I tried in tools to "optimze" and it sways it has 152GB free space and needs optimization:


I executed "Optimize" several times and runs to completion and then says needs to optimize.

I next went to computer management and requested "Shrink Volume" It came back as:


The figure in "enter amount of space to shrink" is much too small for over 100+GB free. I cannot make the number larger.

I wish to shrink the partition to 50GB and free up the 124GB of space.

Here is the current Get-VHD for the space:


What am I missing here to shrink to 50GB?

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
8,894 questions
A Windows technology providing a hypervisor-based virtualization solution enabling customers to consolidate workloads onto a single server.
1,951 questions
No comments
{count} votes

5 answers

Sort by: Most helpful
  1. John Lenz 1,551 Reputation points

    Pictures did not upload


  2. John Lenz 1,551 Reputation points



  3. John Lenz 1,551 Reputation points



    Only 25GB in use on VHDX, how to shrink by 125GB?

  4. XinGuo-MSFT 5,076 Reputation points


    Hyper-V Manager can compact a disconnected VHD/X attached to a powered-off virtual machine.

    You can access the Edit function directly on a VM’s disk property page or by going to the Edit Disk link in the main interface. Use the main interface for VHDXs that have no owning virtual machine.


    On the first screen, you select the target VHDX file. If you started from a VM’s property page, then the Location line is filled in and grayed out.
    Next, the wizard will ask what you want to do with the disk. Choose Compact. If the Compact option does not appear, the virtual machine is turned on or you selected a fixed disk.
    Click Finish on the final screen. You’ll get a small dialog that shows the progress.

  5. John Lenz 1,551 Reputation points

    OK, This is confusing. After compact, the VHD Size & Minimum size remained the same. I successfully did the volume shrink in the VM to the 52439 it showed as below:


    It did free up 50GB of space on the host system which is what I was looking for but no more than 50GB. The VM working partition is now the original size of the VM before I needed some more VHD space for the old WSUS role.

    Here is the Get-VHD that still shows Size & Minimum size the same. Why?


    I did free up some space but why no more than the added 50GB and why Size & Minimum Size still the same?