Powering Off an ESX Server Virtual Machine

Sometimes when you can't power off a virtual machine with the GUI on VMWare Infrastructure client, this following article comes in very handy: [url]http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&docType=kc&externalId=1004340&sliceId=1&docTypeID=DT_KB_1_1&dialogID=21498054&stateId=1 0 21496262[/url] Powering off an ESX Server virtual machine Products VMware ESX VMware VirtualCenter Product Versions VMware ESX 3.0.x VMware ESX 3.5.x VMware ESXi 3.5.x Embedded VMware ESXi 3.5.x Installable VMware VirtualCenter 2.0.x VMware VirtualCenter 2.5.x Component GSS_Fault GSS_SYS_MGMT Symptoms Unable to power off an ESX Server virtual machine. Purpose This article provides methods for powering off an ESX Server virtual machine. Resolution Making sure a virtual machine is powered off Right click on the virtual machine and select power off using the Virtual Infrastructure Client pointed at VirtualCenter Server or the Virtual Infrastructure Client pointed at the ESX host directly. From the Service Console of the ESX host, issue these commands: vmware-cmd stop vmware-cmd stop hard . Where is the path to the configuration file as determined by ‘vmware-cmd –l’ Check the state of the virtual machine after this using: vmware-cmd getstate If none of the above suggestions for stopping the virtual machine work, get the virtual machine's process ID using the following command: ps –auxwww | grep –i VM_NAME Kill the process ID (PID) for the virtual machine (number in the second column of the previous step) using the following command: kill PID After issuing the kill command, wait 30 seconds and check for the process again using: ps –auxwww | grep –i VM_NAME If the process is still present use the following command to stop the process: kill -9 PID Wait 30 seconds and check for the process again. Alternate kill method Determine VMID of the problem virtual machine using: vm-support -x or cat /proc/vmware/vm/*/names Determine the master world ID for the virtual machine using the VMID determined from the previous step for ####: less –S /proc/vmware/vm/####/cpu/status Find group number by scrolling over to Group and finding underneath it vm.#### Run the following commands to kill the virtual machine using the group ID determined from the previous step: /usr/lib/vmware/bin/vmkload_app –k #### If the previous command did not stop the virtual machine: /usr/lib/vmware/bin/vmkload_app –k 9 #### It should be noted, if the virtual machine needs to be stopped using a kill command, the ESX host it is running on may need to be rebooted.