Tuesday, February 12, 2013


The Basics: How to kill a Virtual Machine that’s stuck during shutdown?

When a VM gets stuck during shutdown or isn’t responding anymore you can easily kill the VM. First option is the command line version of vCenter’s “shutdown vm”, first list all the VMs running on the host so you can copy and paste the in to the next command. The command “vmware-cmd stop trysoft” will try to initiate a soft shutdown first, in other words a shutdown via the Guest OS, if that doesn’t work it will do a power off. Now, as most of you probably already experienced, sometimes it’s impossible to shutdown the VMs in a normal way. This is where 2nd, 3rd and 4th option come in to place. Option two uses vm-support to kill the VM, use “-x” to list the VM id’s and kill it with “-X”. The third option uses vimsh, in this case we use vmware-vim-cmd, “vmsvc/getallvms” lists all VMs and the id’s and with “vmsvc/poweroff” you can specify the VM that needs to be powered off. The fourth option is the Linux/Unix way of doing it, find the process id of the VM via “ps -auxwww” and just kill it.
  1. vmware-cmd -l
    vmware-cmd  stop trysoft
  2. vm-support -x
    vm-support -X 
  3. vmware-vim-cmd vmsvc/getallvms
    vmware-vim-cmd vmsvc/poweroff 
  4. ps -auxwww | grep 
    kill 
  5. if option three isn’t successful do the following:
    kill -9 
As VMwareWolf points out, there’s an excellent KB article on this subject to be found here:http://kb.vmware.com/kb/1004340

Followers