Thursday, October 13, 2011

Killing a Hung Virtual Machine on Hyper-V

Petri IT Knowledgebase

Overview

Hyper-V virtual machines usually run without any special issues that cause them to become unresponsive or hung. However, sometimes, for no apparent reason, a VM might seem to hang on the Hyper-V host and nothing you do will close it even if you attempt to shut it down, turn it off, reboot or reset it. Using the Hyper-V Management Console or System Center Virtual Machine Manager (SCVMM) to kill the VM will not work, and the last resort will seem to be to reboot the Hyper-V host itself.

However, rebooting the host will probably affect other VMs that run on the same host. If you're using a Hyper-V Failover Cluster you may be able to move the other VMs to anther node in the cluster which will leave just the failed VM on the host. But what if you don't have a cluster in place and have just one or two hosts that run several VMs?

If it was a "normal" process, you could probably use Task Manager to find the hung process and terminate it. But how do you find the process of the entire VM?

VMware vSphere 5 Video Training

Get the First vSphere 5 Video Training Course! Instructed by vExperts David Davis and Elias Khnaser, this course will help to prepare you for your VCP5 certification. Learn more at
TrainSignal.

VMware vSphere 5 Training - Available Now at TrainSignal

Killing Hung VMs

Task Manager shows a process called VMWP.EXE. This is the virtual machine worker process that runs for every VM that is currently running.

Kill Hung VM

In the above example you only see two instances, but on a production host there may be many instances of the process running. So how can you identify which VMWP.EXE process is the one running for the hung VM?

Read on at the following article:

Get Hyper-V Virtual Machine Process ID and GUID

After finding either the Process ID or the GUID, here is how you can kill a hung VM without affecting the other VMs on the host.

Note: It is always better to properly shut down a VM. If you cannot shut it down, turn it off. Use this tip only if there is no alternative. Remember that killing a VM might corrupt the .VHD file(s) and might cause you to either lose data that was not properly committed to the disk, lose the VM's integrity, or both.

Method 1: Using Task Manager

1. Open Task Manager and click on the Processes tab.

2. Locate the VMWP.EXE processes.

3. Click on View, then click Select  Columns.

Kill Hung VM

4. In the Select Process Page Columns list, select Command Line and click Ok.

Kill Hung VM

5. Back in the Processes tab, expand the Command Line column to be able to see the entire line(s). Locate the VMWP.EXE processes (you will have one for every VM that is running).

Kill Hung VM

6. Note the GUID for the running VMs. Find the one that matches the VM you wish to kill. Right-click the process and select End Process. Acknowledge the message.

Kill Hung VM

Note: You can also use the Process ID parameter to kill the correct VMWP.EXE process.

Method 2: Using Sysinternals Process Explorer

1. Download Sysinternals Process Explorer from the following link:

http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

2. Extract the files(s) to a folder of your choice, then double-click PROCEXP.EXE. Acknowledge the EULA message. Also acknowledge the security warning, if you get one.

3. In Process Explorer, click File > Show Details got All Processes.

Sysinternals Process Explorer

4. Acknowledge the UAC message, if you get one.

Sysinternals Process Explorer

5. Locate the VMWP.EXE processes (you will have one for every VM that is running). Hover with your mouse over the process to see the balloon message. It will give you an indication of the VM's GUID.

Sysinternals Process Explorer

 

6. Find the one that matches the VM you wish to kill.Right-click and select Kill Process. Acknowledge the message.

Kill Hung VM

Note: Again, you can also use the Process ID parameter to kill the correct VMWP.EXE process.

Summary

It's not all that common (hopefully) but it is possible that a VM will hang and it can be very difficult to kill the hung VM if other VM's are running on the host machine.  Hopefully this article walks you through what should be considered to be a "last resort" method of killing the hung VM.

Sent with Reeder


Brief message sent from a handheld device.

No comments: