Powering off an unresponsive VM in ESXi

Today I had an issue with a VM not wanting to power off. I found an excellent article from http://markvansintfiet.wordpress.com/2010/07/28/forcefully-kill-a-virtual-machine-in-esxi/ that I am reposting in case the website ever goes down.

One day you’ll run into a  not responding virtual machine that won’t power off in the vSphere client. If you don’t want to reboot your ESXi host, here is how to forcefully kill the bastard leaving all other virtual machines peacefully running.

Method 1: Use the vmware-cmd command in the vSphere command-line interface (CLI)

  1. Download and install vSphere command-line interface(http://www.vmware.com/download/download.do?downloadGroup=VCLI40)
  2. CD to C:\Program Files (x86)\VMware\VMware vSphere CLI\bin>
  3. List Virtual Machines
    vmware-cmd.pl -H <ESXi host name> -l
  4. Get state:
    vmware-cmd.pl -H <ESXi hostname> “<vmx file path>” getstate
  5. Kill Virtual Machine:
  6. vmware-cmd.pl -H <ESXi hostname> ”<vmx file path>” stop hard

When method 1 fails move to method 2.

Method 2: Find the VM’s process identifier and forcibly terminate it (or use SSH if you are lazy and don't mind opening security holes)

  1. List active virtual machines: vm-support -x
  2. On the ESXi console, press Alt-F1.
  3. Type the word unsupported and press ENTER
  4. Type root password and press ENTER
  5. Look up the VM process pgid: ps –g | grep
    (The number you are looking for is the one that is right before and after mks: and vcpu)
  6. Kill the process: kill -9 <pgid, the number you just found>
  7. Wait a minute and check if the machine is not running anymore: vm-support -x

Leave a Reply

Your email address will not be published. Required fields are marked *