Skip to main content

360 ICT, gegarandeerd betrouwbaar

Can't delete orphaned VM files because a file is in use

We’re in the process of upgrading this server from Win08R2 to Win12R2, which means we have to move a lot of VM’s so we could do a reinstall on the hardware.

Moving VM’s on Win08R2 without SCVMM is a bit cumbersome, because you have to export/import a VM to move it, but hey, after this upgrade we can just “move” the VM without export/import so it should be worth the effort. After the export/import VM in the hyper-v manager you have to delete the orphaned files yourself. So I moved the VM1 from E: to F:, and tried to delete the original VM, but i got the error the file was still in use. My first reaction was *eeek! i made a mistake!*. I checked and doublecheck’d but the VM was already running on the F: and no VM’s were linked to the E:\VM\VM1 location, so whats wrong here?

I used the excellent process explorer to find out which file is in use. With CTRL-F I searched for VM1 (the actual name was different) in all the handles and got this;

From experience i know that vmms.exe is the virtual machine management service, but if wouldn’t i could check the taskmanager for the process ID (PID). You have to add that column because task manager won’t show it by default on Win08R2. If you are lucky then there is a description to find out what the process is for. If there’s no description you can use the “Image Path Name” to give you hints on the manufacturer;

(In my case, i already fixed the issue so the pid in the above picture is different from the first screenshot)

So back to the vmms.exe and the file in use. The vmms.exe is the Virtual Machine Management Service and “manages” the VM’s, which means that if you want to change anything, this service must be running. However, if you stop this service, the VM’s will keep on running and be available, like it says here http://technet.microsoft.com/en-us/library/ee956894%28v=WS.10%29.aspx;
“Virtual machines that are running will continue to run. However, you will be unable to manage the virtualization environment, including your virtual machines, while the service is stopped.”

So i restarted the VMMS;

And after that the vmms with the PID in the taskmanager was gone, i couldn’t find the VM in process monitor and i could delete the files of the VM!

In my experience is hyper-v on Win08R2 still a bit buggy, lots of problems with WMI and although they aren’t critical errors which bring your VM’s down, i’m glad to see hyper-v in 2012/2012R2 hasn’t had these problems. Must be to the complete rewrite of WMI in 2012..

Request Information

Do you want to know more about Can't delete orphaned VM files because a file is in use? Easily request more information.

More Blog Items