none
Disk2vhd | P2V Migration -> How to get rid of the unallocated disk space RRS feed

Answers

All replies

  • Hi,

    You can shrink the VHDX disk by following the steps below:

    1. Shut down the virtual machine.

    2. Open up a Windows Power Shell (Administrator) and first check the VHDX disk status by typing the following command:

    Get-VHD -Path "Path to your VHDX disk"


    You should see a similar result like in the screenshot below:

    3. Now if the MinimumSize is smaller than the Size, you should be able to shrink the VHDX disk.

    4. To shrink the VHDX disk, type the following command:

    Resize-VHD -Path "G:\Hyper-V\WIN10PRO\Virtual Hard Disks\Win10_C.vhdx" -ToMinimumSize

    5. Now type the same command as you did in Step 2, to verify if the VHDX disk got shrinked.

    Get-VHD -Path "Path to your VHDX disk"


    Best regards,
    Leon


    Blog: https://thesystemcenterblog.com LinkedIn:


    • Edited by Leon Laude Sunday, October 14, 2018 12:35 AM corrected
    Monday, October 8, 2018 12:47 AM
  • Hi Leon,

    thank you but this one does not work as you can see here:

    Magnus

    Sunday, October 14, 2018 12:21 AM
  • Sorry, I didn't pay enough attention to your first screenshot, you need the unallocated disk space at the end of the disk inside the virtual machine or you cannot shrink the VHDX at all.

    Blog: https://thesystemcenterblog.com LinkedIn:

    Sunday, October 14, 2018 12:37 AM
  • Hey,

    this is a statement but no solution -> there must be a way to fix this one -> cannot is no option.

    Magnus

    Tuesday, October 16, 2018 9:45 PM
  • Unless you have the possibility to copy everything from the "DATA (D:)" partition to somewhere else, then delete the DATA (D:) partition and then re-create it, the last option is to use third party tools.

    There is for example GParted tool which is an open source tool, below you can find a guide on how to fix virtual disk resizing issues with GParted:

    https://blog.workinghardinit.work/2016/08/16/fix-virtual-disk-resizing-issues-with-gparted/


    Blog: https://thesystemcenterblog.com LinkedIn:

    • Marked as answer by Magnus-S Saturday, October 20, 2018 10:20 PM
    Tuesday, October 16, 2018 10:07 PM
  • Hi Leon,

    GParted worked like a charm, thanks a lot for your suppport.

    Magnus

    Saturday, October 20, 2018 10:20 PM
  • Glad to hear you worked it out!

    Blog: https://thesystemcenterblog.com LinkedIn:

    Saturday, October 20, 2018 10:21 PM