Shrinking VHDX partion that held SQLserver DB

John Lenz 1,721 Reputation points
2022-08-29T21:06:38.327+00:00

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:

235913-wsus-cdrive-optimization-loop.jpg

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:

235931-wsus-shrink-volume-starting-point.jpg

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:

235906-wsus-get-vhd-screen.jpg

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.
12,211 questions
Hyper-V
Hyper-V
A Windows technology providing a hypervisor-based virtualization solution enabling customers to consolidate workloads onto a single server.
2,561 questions
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. John Lenz 1,721 Reputation points
    2022-08-30T16:14:35.077+00:00

    Pictures did not upload

    236188-wsus-cdrive-optimization-loop.jpg

    0 comments No comments

  2. John Lenz 1,721 Reputation points
    2022-08-30T16:15:17.847+00:00

    Next

    236251-wsus-shrink-volume-starting-point.jpg

    0 comments No comments

  3. John Lenz 1,721 Reputation points
    2022-08-30T16:16:35.02+00:00

    Last

    236140-wsus-get-vhd-screen.jpg

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

    0 comments No comments

  4. XinGuo-MSFT 14,696 Reputation points
    2022-08-31T03:04:32.337+00:00

    Hi,

    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.

    compact-hvmstarts.png

    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.
    compact-browse
    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.
    compact-opselect.png
    Click Finish on the final screen. You’ll get a small dialog that shows the progress.
    compact-finishwiz.png

    0 comments No comments

  5. John Lenz 1,721 Reputation points
    2022-08-31T15:18:11.553+00:00

    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:

    236554-vhdx-shrunk-to-121-gb.jpg

    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?

    236449-wsus-get-vhd-screen-after-shrink.jpg

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