Today I needed to shut down a virtual machine that was unresponsive. I tried to issue the Power off command from the vSphere client but after some minutes it was still in progress…
The solution was to kill the process that runs the VM directly on the server where the VM is located, let’s see how to do it:
1) connect to the server via SSH
2) type the command:
esxcli vm process list
3) take note of the VM’s World ID:
4) kill the process using the command:
esxcli vm process kill -t=soft -w=7321000
(replace the World ID value with the one of the VM you want to kill).
The -t parameter set the type of kill:
[checklist]
- soft, the one to be used first, tries a “clean” shutdown
- hard, immediately kills the process (like kill -9 under Linux)
- force, should be used as a last resort attempt
[/checklist]