Online Compact VHDx ?

Hello,

I'd like to know if is possible perform an VHDX compact action without stopping the Virtual machine. I guess that is not possible, but just to confirm.

I don't want to reduce (shrink) the size, just 'compact' the VHDX

We can't stop production virtual machines easily to perform this action...

Regards


  • Edited by Pep M Monday, April 27, 2015 11:50 AM
April 27th, 2015 11:31am

No, only online resize is possible : Shrink and Expand (and your VHDx should be connected to an iSCSI controller)

Compacting a VHD is not possible online.

But you can do it another way:

1- Shrink the volume inside the OS

2- Shrink the VHDx using online resize in Hyper-V

3- Expand the VHDx using online resize in Hyper-V

4- Expand the volume inside

Free Windows Admin Tool Kit Click here and download it now
April 27th, 2015 1:06pm

Hi,

Doing some testing about this I've detected that when I've move VM guest storage to another CSV space is reclaimed.

This is what I've tested.

On a Hyper-V server (from a FailOver Cluster) W2K12 R2

I've created a VM machine with W2K12 R2 with an attached 1TB VHDX. I've filled it with random data. VHDX disk growed from few initial Gb up to 1TB.

Then I've deleted data (del *.*), and VHDX size remains intact (1TB).

Then I've moved VM storage to another CSV, and for my surprise the VHDx size were reduced at minimum level.

And I didn't do any type of "OPTIMIZE", not in guest not in HyperV host.

Regards

April 30th, 2015 3:04am

That makes perfect sense.

When you create a dynamically expanding virtual disk, as you add and delete content, it will continue to grow until it reaches its maximum size.  But internal to the disk, there is a specific amount of mapped data - that data you have not deleted.  When you move the storage from one location to another, it is going move the mapped data, none of the deleted data.

If you use a fixed size virtual disk, its file size on the host system will remain a constant.

Free Windows Admin Tool Kit Click here and download it now
April 30th, 2015 4:26pm

Also if your SAN has UNMAP then the space inside the VHDX will be reclaimed as usable space to the SAN. 

http://blog.workinghardinit.work/2012/05/23/trimunmap-support-in-windows-server-2012-hyper-vvhdx/

April 30th, 2015 10:21pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics