Issue Reported:

Running Virtual machine with Windows 11 Operating System. Noticed that OS consumes only 32GB but disk space shows more than 55GB in the Current File Size.

Did disk cleanup including Windows Files deletion but still same has been noticed in the Virtual Disk Properties.

Resolution:

Step 1: Mount the Virtual Disk in the base Server using the following PowerShell Command

Mount-VHD -Path 'D:\HyperV_Root\Windws_Insider\WIN11-LAB-ReleasePrev\WIN11-LAB-ReleasePrev\Virtual Hard Disks\WIN11-LAB-ReleasePrev.vhdx'

Step 2: Running the following commands one by one. Assuming F is the drive letter the VHDX file mounted. If not, change according to the drive letter accordingly.

Defrag F: /x
Defrag F: /k /l
Defrag F: /x
Defrag F: /k

Step 3: Dismount the Virtual Disk after the successful execution of the above commands.

Dismount-VHD -Path 'D:\HyperV_Root\Windws_Insider\WIN11-LAB-ReleasePrev\WIN11-LAB-ReleasePrev\Virtual Hard Disks\WIN11-LAB-ReleasePrev.vhdx'

Step 4: Now let’s execute the below command

Optimize-VHD -Path 'D:\HyperV_Root\Windws_Insider\WIN11-LAB-ReleasePrev\WIN11-LAB-ReleasePrev\Virtual Hard Disks\WIN11-LAB-ReleasePrev.vhdx'

Now, You should be able to see the disk space has been reduced in the VHDX Level

Author

Leave a comment

Your email address will not be published. Required fields are marked *