I am Dale Hayter, a Microsoft and VMware certified Technical Consultant.

My blog has been built up over the years from my experience of working on an IT helpdesk and also from being out on-site.

How to forcefully kill a virtual machine in VMware ESX and ESXi

I had an error message come up about a VM:

The redolog of xxxxx.xx.vmdk has been detected to be corrupt. The virtual machine needs to be powered on. If the problem still persists, you need to discard the redolog.

I couldn’t power off the VM and it was stuck in an endless loop prompting me to click okay.

Found a good guide on how to kill the VM without having to power cycle the host.

[ad#ad-1]

– SSH to the Host that has the VM running on it.

– We need to run a command to find out the VM ID for the VM having the issue.

cat /proc/vmware/vm/*/names

This will return a line for each VM running.

vmid=1251   pid=-1     cfgFile="/vmfs/volumes/48ee2ea5-0d1d15c7-0d1c-001f2955194d/example/example.vmx"  uuid="56 4d 07 c7 3f 85 f9 09-35 56 41 8c e9 e2 54 7b"  displayName="example"

So if we wanted to kill the VM called example we will need to take note of the ID, which as you can see above is 1251.

We now need to find out the Master World ID number.

less -s /proc/vmware/vm/1251/cpu/status

A table will then appear. If you scroll to the right you should see a value under group. It will be something like vm.1234.

In this example the number will be 1234.

Run this command to kill it.

/usr/lib/vmware/bin/vmkload_app -k 9 1234

If you got the right number you should see a line come back with

Warning: Apr 22 09:01:35.476: Sending signal '9' to world 1234

Your VM should now be off.

Link : VMware Forum

ESXI

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 another virtual machine the one in question, you can cause downtime for the other virtual machine.

If the vmx process is listed, terminate the process using this command:

kill ProcessID

Wait 30 seconds and repeat step 1 to check for the process again.
If it is not terminated, run this command:

kill -9 ProcessID

Wait 30 seconds and check for the process again.