How to kill a VMware VM that is locked up?

A VM is stucked and you can’t do anything on it- power on/off, add to inventory etc. In the VM configuration folder, there’s a file VM_NAME.vmx.lck

Find out which host has the lock

# vmkfstools -D /vmfs/volumes/datastore/VM_NAME/VM_NAME.vmx
Lock [type 10c00001 offset 165951488 v 283, hb offset 4022272
gen 81, mode 1, owner HOST_UUID mtime 6934485
num 0 gblnum 0 gblgen 0 gblbrk 0]
Addr , gen 40, links 1, type reg, flags 0, uid 0, gid 0, mode 100755
len 4771, nb 1 tbz 0, cow 0, newSinceEpoch 1, zla 2, bs 8192

Find the host with HOST_UUID

Most likely, one of the hosts in the cluster is holding the lock. Run this command on every host in the cluster.

# esxcfg-info -y | grep  "System UUID"
   |----System UUID.................................................HOST_UUID

Get the VM World ID

Once you have identified the host, find the VM World ID

  # esxcli vm process list | grep -C5 -i VM_NAME
VM_NAME
   World ID: 279835
   Process ID: 0
   VMX Cartel ID: 45368602
   UUID: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
   Display Name: VM_NAME
   Config File: /vmfs/volumes/datastore/VM_NAME/VM_NAME.vmx

VM_NAME_X
   World ID: 45107392
   Process ID: 0
   VMX Cartel ID: 45107391

Kill the vm

# esxcli vm process kill -w 279835 -t force

Verify a VM with that World ID is gone

# esxcli vm process list | grep -C5 -i VM_NAME
#
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s