Wednesday 20 March 2013

How to kill a Virtual Machine Process using CLI and ESXTOP

Sending signals on ESXi to power off the virtual machine

Warning: This procedure is potentially hazardous to the ESXi host. If you do not identify the appropriate process ID (PID) and kill the wrong process, it may have unexpected results. If you are not comfortable with the following procedure, file a support request with VMware Technical Support and note this Knowledge Base article ID (1014165) in the problem description.

In ESXi 3.5-5.x, you can use the kill command to send a signal to, and terminate, a running virtual machine process.

Step 1: On the ESXi console, enter Tech Support mode and log in as root.

Step 2: To determine if the virtual machine process is running on the ESXi host, run this command:

#ps | grep vmx

The output appears similar to:

7662 7662 vmx /bin/vmx
7667 7662 vmx /bin/vmx
7668 7662 mks:VirtualMachineName /bin/vmx
7669 7662 vcpu-0:VirtualMachineName /bin/vmx


Several rows are returned, one for each vmx process. Identify the parent vmx process for the target virtual machine. The first column contains the PID, and the second contains the parent's PID. Ensure you terminate only the parent process. The parent Process ID (PID) for each process is listed in the second column, identified in this example in bold. Take note of this number for use in the following steps.

Caution: Ensure that you identify the line specific only to the virtual machine you are attempting to repair. If you continue this process for a virtual machine other than the one in question, you can cause downtime for the other virtual machine.
Step  3: If the vmx process is listed, terminate the process using this command:

#kill ProcessID

Note: Wait 30 seconds and repeat step 2 to check for the process again.

Step 4: If it is not terminated, run this command:

#kill -9 ProcessID
Note: Wait 30 seconds and check for the process again.


Using esxtop to send a signal to, and kill, a running virtual machine process


Step 1: On the ESXi console, enter Tech Support mode and log in as root.
Sep 2: Run the esxtop utility using this command:

#esxtop

Step 3: Press c to switch to the CPU resource utilization screen.
Step 4: Press Shift+v to limit the view to virtual machines. This may make it easier to find the Leader World ID in step 7.
Step 5: Press f to display the list of fields.
Step 6: Press c to add the column for the Leader World ID.
Step 7: Identify the target virtual machine by its Name and Leader World ID (LWID).
Step 8: Press k.
Step 9: At the World to kill prompt, type in the Leader World ID from step 6 and press Enter.
Step 10: Wait 30 seconds and validate that the process is not longer listed.

No comments:

Post a Comment