Jump to content

Recommended Posts

Posted

Hello.

I have a physical server that has 2 virtual servers running on.The physical server (Drive E) where the VHD and VM folders are stored for these virtual servers are start to run low on disk space. I deleted about half a TB data from one of the virtual servers but that didn’t reflect on the physical server’s drive.Is there a way to shrink the hard drive of the virtual server to give space on the physical server? Thank you in advance!

Posted
You need to shut down the VM, then in Hyper-V manager, open the VM settings, go to the disk and you should see an option to modify. Run this and you'll have the option to shrink. However if it doesn't shrink as much as you hope, you might need to defrag the drive in the VM before trying to shrink it.
  • Thanks 1
Posted

Hi.

 

Thanks for this.

 

I have another VM which is off so I tried to test this but could not see an option called modify.

 

When I got to the disk of this vm it only gave me the option of New, Edit, Inspect and Browse.

 

I did look at edit which gave me Compact, Convert and Expand. I did try Compact but it did not shrink the drive.

 

Thanks

Posted
Windows can place files at the end of the drive (physically), HyperV can only compact down to the last block used on the drive, so if there is a file at the end of the drive, it wont compact. You need to do a "defrag c: /D" (replacing the C: with drive letter you wish to compact) in your guest, in order to force windows to move everything to the beginning of the drive (The GUI defrag does not do this).
  • Thanks 1
Posted
Hi.

 

Thanks for this.

 

I have another VM which is off so I tried to test this but could not see an option called modify.

 

When I got to the disk of this vm it only gave me the option of New, Edit, Inspect and Browse.

 

I did look at edit which gave me Compact, Convert and Expand. I did try Compact but it did not shrink the drive.

 

Thanks

 

You were right with edit and compact. Sorry I got that wrong.

 

Are your disks fixed size or expanding?

 

Shrink the partition in your VM first, you might need to run a defrag first if it doesn't let you shrink it far. Shut the VM down and then do that process again.

  • Thanks 1
  • 2 months later...
Posted

Hello.

 

Thank you guys for the replies on this thread.

 

I wanted to do the compact of the hard drive following this article https://www.altaro.com/hyper-v/compact-hyper-v-virtual-disks-vhdx/ but when I got to do it, it came up ‘Edit is not available because checkpoints exist for this virtual machine’. Done a bit more research and found this article https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/checkpoints which I followed to delete the checkpoint via the hyper v console. It was all looking good the C drive was done but when it got to do the E drive which is where all the files are the physical servers hard drive run out of space and on 85% the virtual file server merging status said failed. As I was watching the drive getting lower and lower I quickly shut down the dc which is the only other vm that we have and sits on the same physical drive as the file server.

 

At the moment temporarily I’m moving off the DC’s vhdx and avhdx files to make space again on the physical servers HD. I still have 2 more checkpoints that I could delete for this file server. Do you think once I have about 200GB space I could delete another checkpoint and the merging would start again? Or because the previous failed this would be a bad idea?

 

I have an identical copy of the file server’s E drive (avhdx and vhdx files) which I copied prior to the merging so maybe I could put those back and start again? Although not sure the checkpoint would show up again in the hyper v console which is where I originally deleted.

 

It’s a mess!

 

Any advice would be much appreciated!

 

Thank you

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...