Share via


after deleting files on machine VHD size is not decrising

Question

Monday, November 20, 2017 1:23 PM

my base machine is windows 2012R2 Hyper-v Core. on top of that i created two Vms. when ever i deleted files on vms the same is not applying on VHDs. this is problem on both VMs. 

All replies (6)

Monday, November 20, 2017 1:37 PM

Hi Hari,

Deleting the files inside the VHD will not reduce the VHD's size instead it give free space inside the VHD (i mean inside the VM). If you really want the VHD size to be reduced, then shrink the disk inside the VM using disk management. The amount of size you get as unallocated can be cleared on the physical disk by resizing the VHD from the Hyper-V console using Edit disk option

Regards,
Bala


Monday, November 20, 2017 1:54 PM

Thank Bala,

after running the compact also space is free up on VHD. is it any other way to free up size of VHD.


Monday, November 20, 2017 1:58 PM

Hi,

Delete unwanted data inside the VM. Free up some space. Run defragmentation

Then use shrink option in Disk management of  the VM and get the unallocated space

Then use the resize option to resize the VHD on the Hyper-V console

Regards,
Bala


Tuesday, November 21, 2017 3:10 PM

Like Bala said, there's a few steps to decreasing a vhd size.

You don't want to have this become a habit though- you're going to have to redo this every time you want to reduce the size of the VHDs and this is by design.


Wednesday, November 22, 2017 10:43 AM

HI Bala,

This is not working.


Wednesday, November 29, 2017 7:58 AM

Hi Hari,

After shrink the disk in the VM, please compact the disk again from Hyper V Server Manager. If it still not work, we may mount the disk to the Hyper V host and compact, after that, dismount the virtual disk.

Best Regards,

Anne

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact [email protected].