Did VHDX really shrink?

John Lenz 1,736 Reputation points
2021-05-03T22:10:07.453+00:00

Server 2012R2 running Hyper-V
Hyper-V server 2012R2 (SQLserver2012)

OK, I followed the process to shrink the VHDX to free up space.

Here is VM disk Partition:

93415-longsql2012-volume-shrink.jpg

This is the Get-VHD that shows the before & after of the shrink command and the file explore winnow Did it shrink physically or not?

93385-longsql2012-get-vhd.jpg

Windows for business | Windows Client for IT Pros | Storage high availability | Virtualization and Hyper-V
{count} votes

12 additional answers

Sort by: Most helpful
  1. Anonymous
    2021-05-03T22:37:14.18+00:00

    A couple of things;

    • The shrink operation fails if it would shrink the virtual disk to less than its minimum size (available through the VHDX object's MinimumSize property).
      • If the virtual disk file connects to a virtual machine's IDE chain, you cannot resize the virtual disk while the virtual machine is online. If the virtual disk file connects to a virtual machine's SCSI chain, you can resize the virtual disk while the virtual machine is online.

    https://learn.microsoft.com/en-us/powershell/module/hyper-v/resize-vhd?view=windowsserver2019-ps

    --please don't forget to Accept as answer if the reply is helpful--

    0 comments No comments

  2. Anonymous
    2021-05-04T02:13:56.217+00:00

    Hi,
    For your reference:
    https://learn.microsoft.com/en-us/windows-server/storage/disk-management/shrink-a-basic-volume

    -----------------------------

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

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  3. Anonymous
    2021-05-04T02:34:57.173+00:00

    Any progress or updates?

    --please don't forget to Accept as answer if the reply is helpful--

    0 comments No comments

  4. John Lenz 1,736 Reputation points
    2021-05-04T15:10:43.797+00:00

    OK,

    Please look at the attachments

    1. I successfuly shrunk the partition on the VM machine SQL2012. If I took a screen shot before the Resize-VHD command, it would have show unallocated space at the end of the partition
    2. I executed the Resize-VHD command and it executed successfully, as shown
    3. the post Resize-VHD shows Size shrinking to 166GB

    Why did the Get-VHD file size not shrink as well. The file explorer still shows the file as 300+ GB. I need to recover space on the drive ASAP.

    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.