Link to home
Start Free TrialLog in
Avatar of M A
M AFlag for United States of America

asked on

Hyper-V VHD expanding everyday. How to reduce the VHD Size.

I have a RAID Array 250GB usable space configured with 5 Partitions 50GB each..
I have installed 5 VMs Each VM in each drive.
Out of that 2 VMs expanding every day aprox 0.5-1GB expansion/day.
all other partions are having more 50% free space.
The data within in the VM is the same no change.

VHD size is 45GB+ in these 2 partitions

How to reduce the VHD size of these 2 partitions.
Avatar of dalberson
dalberson
Flag of United States of America image

In normal usage, and over time, some VM's grow when dynamic disks are used. This is a good thing if you need them to grow, but, in your case, since you don't have much room for them to grow, I would say you have two choices.

1. Establish a schedule for compacting the disks. This should be done often enough to avoid the disk attempting to expand more than it has capacity to do so.
     - If you have 10GB of room and you grow 1 GB per day, then you must compact at least every 9 days.

2. Rebuild the VM's as "fixed disks" to keep them from growing dynamically. The downside is - you may run out of disk space for paging, normal operations, etc. but at least your VM's will NOT expand and fill up the actual partition they are on.

Let me know if this is helpful, or, if I misunderstood your situation.
Avatar of M A

ASKER

I am wondering why only these 2 VMs expanding like this.
I think I gave 127GB HDD space for these 2VMs.  Could be bcoz of that?
Rest all 3 I gave 50GB space in the VM

And recently installed windows7SP1 automatically by the windows update.
This could be the reason?
As far as I see the issue has been cause by the fact that the initial 250GB space has been split in 5 partitions. This was not a recommended configuration and it basically removes one the main advantages of virtual machines, like sharing disk space.

As a long-term solution I would recommend reverting back to a single space for all VHD files. There are two ways to do it, depending on where the config files are located. If they are located on the same 50GB volumes then the only available solution will be to export all virtual machines, delete them from Hyper-V manager, remove all 50GB partitions and create a single one of 250GB, then import the virtual machines back. If the config files reside on different volume, then you don’t need to export/import the full VM – only copy the VHD files out and then back to the big volume and reattach them to the VMs. Note, that you must not have snapshots if the second method is used.
Avatar of M A

ASKER

@Svet Paperov
I know it is not recommended but I am having another RAID array with is less than 250GB
I am mirroring the partition to the other partition in the second RAID using windows mirroring.
What is different about these two VMs? What is it that is grabbing the extra space?
Avatar of M A

ASKER

It's recently updated by SP1 and few other updates. It has HDDsize 127gb
Avatar of M A

ASKER

I noticed one thing today. The other VMs also started the same issue.
This is bcoz of windows updates and SP1 installation.

How to reduce the size ?
SOLUTION
Avatar of Svet Paperov
Svet Paperov
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of M A

ASKER

@Moderator
Appreciate if you can keep it open for couple of days more as the proposed solutions was not successful yet.
Or if you want me to close and reopen please let me know
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of M A

ASKER

Thanks to all experts