Space has Ran out on Hyper-V Host Drive because a VM VHD has Expanded

2017-12-11T11:09:07+00:00 October 15th, 2009|Azure, Cloud, Windows|

You may see this issue if you are running Hyper-V hosts, this issue occurs when you have set your VHD to dynamically expand, and over time the VHD has actually increased to the size of the drive it is held on. When this occurs the offending machine will be stuck in a paused-critical state.

image

A way to fix this issue is to compact the VHD and in my experience it tends to get back quite a lot of space. Compacting the VHD basically claws back any space that isn’t being used by the VHD. To do this there must actually be Free Space on the drives inside the VM otherwise this will have no effect.

To look at a way of clearing up some space to compact the VHD as temporary measure is to have a look at my previous article”http://support.risualblogs.com/blog/2009/10/14/running-low-on-disk-space-on-a-drive/”.

Fixing this should probably be only a temporary measure as you are having this issue because the drive that hold’s the effected VM’s VHD is stored on does not have to space. And the real solution is to move the vhd to a bigger disk. That said if you must get the VM back up quick read on!!

 

To Compact a VHD 

First of all if we connect to the Virtual server host, that holds problematic VM.

image

Now we  need to shut down the effected VM, as the VM is in a paused-critical it can be quite a pain, you can keep hitting resume on the VM and try shutting it down through the Guest OS. Or You can just right click and turn off the machine, which is basically the same as just pulling the plug out of the server.

Now we need to compact the VHD , so if we right click the VM again and choose settings

Now you will see all the VM’s Settings, but what we are after is the VHD which is causing the issue, so if you look at the left hand side of the Settings windows and you’ll be able to see the VHD. So if you Just single click on the VHD in question.

Now you will see and Edit option, if you just press that and then a “edit virtual hard disk wizard” will appear and if we simply choose the compact option and follow the wizard through and then we are done.

The Process should take 10-15 minutes and then you can just turn the VM back on and it will run successfully.

image

Daniel Davies