Shrink VHDX fails but space is available.

John Lenz 1,726 Reputation points
2024-02-27T18:35:04.2366667+00:00

Server 2012R2 STD (Hyper-V system) Exchange Server2013 role I am trying to free up space on the Hyper-V Host system. I work the process correctly but th VM comes back with "no space". I ran defrag - OK Here is the process stream: Host system Get-VHD file sizing

VM partition Disk_Mgmt partion size

Shrink Volume reporting: Shrink Volume_initial

Set shrink size to 60GB. Shrink Volume_60 GB

Processed Shrink and received this message. Shrink Volume_no space msg

What do I do to shrink this volume? Exchange DB is on the VM Thanks

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,938 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Net Runner 610 Reputation points
    2024-03-03T19:32:03.55+00:00

    There may be files on that VHDX that are located closer to the end of the volume and are currently in use, which prevents defrag to optimize them and makes it impossible for you to shrink the volume. I would highly recommend you restart the virtual machine and try once again to see if that makes any difference. Alternatively, just shut down the virtual machine, attach the VHDX file in question to a different VM or the host directly, and perform the shrink. That should work.

    Depending on what kind of data is hosted inside this virtual machine, you may also consider using Windows Deduplication to reduce storage consumption. It works exceptionally well on file servers. You can estimate your storage savings using a free analyzer tool https://www.starwindsoftware.com/starwind-deduplication-analyzer and see if it brings you even more storage gains than the shrink.

    0 comments No comments

  2. Ian Xue (Shanghai Wicresoft Co., Ltd.) 36,336 Reputation points Microsoft Vendor
    2024-03-05T07:46:43.4433333+00:00

    Hi John,

    Thanks for your reply. There might be cache in the virtual disk. Try reboot the VM or type more smaller shrink numbers and see if it works.

    If that doesn’t help, you might need to use a data-moving tool. Create a new VHDX of the desired size and use something like robocopy to transfer the contents of the old disk to the new. I would not use this for operating system volumes, but it works well for data-only volumes. In fact, you could take these steps:

    1. Turn off the owning VM
    2. Disconnect the VHDX
    3. Mount the old VHDX and the new in the management operating system
    4. Use robocopy or a similar tool to transfer the files
    5. Dismount both VHDXs from the management operating system
    6. Attach the new VHDX to the VM in place of the old

    Robocopy has switches to copy ACLs and file descriptors. You will need to double-check that the operating system reconnects any shared folders, though.

    Best Regards,

    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.