Power off an unresponsive VM using ESXTOP

Just recently we have some hardware issues in our primary datacenter and during that time had a few VM’s that became unresponsive and needed to get them back online. The VM’s had stopped responding to the normal vSphere commands to reboot, shutdown or even restart. I didn’t want to power cycle the entire ESXi host and instead just power off an unresponsive VM.

Here is a quick and easy way to do just that using ESXTOP.

How to kill an unresponsive VM using ESXTOP

  1. SSH into the host that the virtual machine is currently running on using PuTTy or your choice of client.
  2. Type: esxtop to start ESXTOP.
  3. Press c to enter the CPU view of ESXTOP.
    Note: It may be helpful to press shift and V so that only VM’s are shown.
  4. Press f to change what display fields are shown and press c to show the LWID field, then press ENTER to go back to the CPU view.
    SSH add LWID field
  5. Finally, press k to open the “kill” prompt and enter the LWID of the VM you would like to power off and press ENTER.
    Using ESXTOP to kill VM using LWID

At this point the VM should be powered off. Keep in mind this will perform a hard power off, similar to yanking the power from a physical box so you really only want to do this if the VM is not responding to any other commands in order to gracefully power it off.

How to kill a VM using vSphere CLI

You can get the same result as above, powering off a VM, and not needing to use ESXTOP at all.

  1. SSH into the host where the unresponsive VM is located and type the following:
    vim-cmd vmsvc/getallvms
  2. Take note of world ID of the VM and then use the following command to issue a shutdown by typing, making sure to replace (vmid) with the world ID:
    vim-cmd vmsvc/power.off (vmid)
  3. If you find the VM still won’t power off you can kill the PID for the VM. Use lsof to find the pid that has the vmx (config file) open and then use kill to terminate it.
    lsof /vmfs/volumes/datastore/vmname/vmname.vmx
    kill -9 (pid)

Thanks goes to /u/Acaila on Reddit for pointing out this other method!

Similar Posts

  • VMware vSphere 5.5 Update 2 released

    vsphere 5.5 update2 released

    VMware vCenter Server and ESXi 5.5 Update 2 has just been released today with a number of fixes and additional features such as vCenter Server database support for Oracle 12c, Microsoft SQL Server 2012 Service Pack 1, and Microsoft SQL Server 2014 in vCenter Server and support for ESXi hosts with 6TB of RAM in the ESXi 5.5 update 2 release!

    Read More “VMware vSphere 5.5 Update 2 released”

  • VMware ESXi 5 home lab upgrade

    In the past I’ve been using a single server to run my VMware ESXi home lab. it was slow, old, big and loud. I’ve been meaning to upgrade my home lab for a while and just never got around to it, until now! When looking for new hardware I wanted the servers to be as compact as possible, quiet, and low energy usage as possible while still having some horsepower.

    I debated on going the whitebox solution as I build all my own desktops anyway, I also looked at several other solutions such as the HP ML310e server, Shuttle XH61V barebones machine, but ultimately decided to go with two Intel NUC i5’s.

    Intel NUC i5 and 16GB ram

    Intel NUC i5 DC53427HYE Features:

    • Uses very little energy
    • Completely quiet
    • Supports up to 16GB RAM
    • A dual core CPU that scores nearly 3,600 in PassMark benchmarking
    • Includes vPro which allows me to easily run both NUC’s headless
    • Extremely small, nearly 4 1/2″ inch square footprint

    Read More “VMware ESXi 5 home lab upgrade”

  • VMware vSphere 7 announced

    VMware vSphere 7

    Some pretty big news coming out of VMware today. The announcement of VMware vSphere 7 to become available May 1, 2020! One of the biggest item coming out of this news so far is that vSphere 7 will come in two options.

    The first being vSphere 7 as we all have known it to be for years and then the second being vSphere 7 with Kubernetes which will be available through VMware Cloud Foundation and is a new generation of vSphere for containerized applications.

    Other notables is that the flash based vSphere client is FINALLY no more! From here on out, only the HTML 5 will exist. vCenter Server on Windows will also finally be put to rest and new deployments of vCenter server will be done using the tried and tested vCenter Server Appliance (VCSA) based on PhotonOS linux.

    Read More “VMware vSphere 7 announced”

  • VMware Recertification Policy

    VMware certified

    Starting today, March 10 2014, new VCP certifications must be re-certified within two years of it’s earned date. Anyone who currently has their VCP certification prior to March 10 2013 has until March 10, 2015 to re-certify.

    The new policy gives you three options to re-certify:

    1. Take the current exam for your existing VCP certification solution track. For example, if you are a VCP3, you could take the current VCP5-Data Center Virtualization (VCP5-DCV) exam.
    2. Earn a new VCP certification in a different solution track. For example, if you are a VCP-Cloud, you could recertify by earning VCP5-Desktop (VCP5-DT) certification.
    3. Advance to the next level by earning a VMware Certified Advanced Professional (VCAP) certification. For example, if you are a VCP5-DCV you could earn VCAP5-DCA certification.

    I can understand why they are doing this but I don’t agree with the changes. As per the announcement if you let your certification expire, “Your certification will be revoked,and you will no longer be entitled to use the certification logo or represent yourself as VMware certified“. Really? You mean everything that was done prior and after taking the exam means nothing?

    Read More “VMware Recertification Policy”

  • VMware VCP5-DCV Delta Re-certification Exam

    VMware VCP DCV

    Looking to renew your VCP before the March 10th 2015 expiration date? Then the new VMware VCP5-DCV Delta (Exam Code VCP550D) is a cheaper way to renew your VCP without taking the full on exam or not just ready to tackle the VCAP. The new exam covers new material between the vSphere 5.0/5.1 and vSphere 5.5 exams – looking the the blueprints, most noticeably VSAN.

    While you still have to schedule the exam through Pearson VUE, you don’t have to take the course at a testing center and instead can take it online from any device!

    Read More “VMware VCP5-DCV Delta Re-certification Exam”

Leave a Reply

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

One Comment

  1. This is a nice post, I thought I would add that Ghost PIDs & WIDs exist. If you run either of the commands listed in this post and the result is “PID or WID not found.” Double check the PID/WID and if it is correct, a reboot of the ESXi host is the only fix.

    We only encounter this in our Horizon View Cluster and it happens for customers on ESXi 5.x and ESXi 6.x running View 5.x or 6.x.