Vsphere snapshot hang – How to (force) kill a VM process
I had a frozen VM because the snapshot hang at 95%. I could not do anything to the VM because its process is locked to the host. I couldn’t stop it, couldn’t cancel the task either. To release the lock and force kill it, I had to do the following:
- Restart the management agents
- Force stop the VM
- Consolidate the snapshot (if necessary)
- Restart the VM
1. Restart the management agents
These 2 commands should do
1 2 |
/etc/init.d/hostd restart /etc/init.d/vpxa restart |
2. Force stop the VM
a. The VMWare way
1 |
esxcli vm process list |
VM's NAME
World ID: 46664
Process ID: 0
VMX Cartel ID: 46640
UUID: 42 24 e8 f3 28 35 e1 77-dd 56 40 46 d2 a4 16 43
Display Name: plsw-ts2012-fe1
Config File: /vmfs/volumes/5156099e-0e41f131c77b4/VM-NAME/VM-NAME.vmx
Then collect the “Word ID” and run either of these commands
1 2 |
esxcli vm process kill -t force -w 46664 esxcli vm process kill -t hard -w 46664 |
At this point the VM should be stopped and the lock is released. You might need to remove and re-add it. If the VM is still lock, we will need to force stop it the Linux way
1 |
ps | grep VM-NAME |
~ # ps | grep 52173320
52173320 52173320 vmx /bin/vmx
52173323 52173320 vmx-vthread-4:VM-NAME /bin/vmx
52174736 52173320 vmx-vthread-5:VM-NAME /bin/vmx
52174737 52173320 vmx-mks:VM-NAME /bin/vmx
52174738 52173320 vmx-svga:VM-NAME /bin/vmx
52174741 52173320 vmx-vcpu-0:VM-NAME /bin/vmx
The second column is the master process number . Run this command to kill it
1 |
kill -9 52173320 |
KB 1004340 should provide you with some more methods but these 2 are usually good enough