When files are in use they are locked to prevent modifying by anything else. In a VMFS volume sometimes these files stay locked even when they are not in use (possibly when a VM was not stopped properly). This doesn't happen often, but it can be annoying when it does and you will get a busy, locked or in use error. To fix this you need to release the lock on the file.

Logon to the ESX Server that was last running the VM.

Dump the log information:
vmkfstools -D /vmfs/volumes/path/to/myvm1

Check the log:
less /var/log/vmkernel
...
Dec 15 14:31:34 vm19 vmkernel: 1:02:11:14.325 cpu3:1038)Lock [type 10c00001 offset 30439424 v 21, hb offset 4154368
Dec 15 14:31:34 vm19 vmkernel: gen 37671, mode 1, owner 2a3b5a3-cb2591a3e-b657-e18b9e6d24b6 mtime 8781867]
...

The owner locking the file is on the line where it says owner "owner 2a3b5a3-cb2591a3e-b657-e18b9e6d24b6". Get the last part of that hex value "e18b9e6d24b6".

Find the system UUID of all the ESX Servers so you know which one is locking it:
esxcfg-info | grep -i 'system uuid' | awk -F '-' '{print $NF}'
ps -elf | grep myvm1
/usr/lib/vmware/bin/vmkload_app /usr/lib/vmware/bin/vmware-vmx should have a lock on the VMs file.

 

Kill the master user world id (vmid):

 

cat /proc/vmware/vm/*/names | grep myvm1

less /proc/vmware/vm/ value/cpu/status

/usr/lib/vmware/bin/vmkload_app -k 9 vmid#

 


Failing that crash the VM and get the logs (run in a directory with some space to spare):
vm-support -x
vm-support -X vmid#



Share this blog post on social media:

Social Links

Disclaimer

All advice, installation/configuration how to guides, troubleshooting and other information on this website are provided as-is with no warranty or guarantee. Whilst the information provided is correct to the best of my knowledge, I am not reponsible for any issues that may arise using this information, and you do so at your own risk. As always before performing anything; check, double check, test and always ensure you have a backup.

Copyright ©2016 Andy Barnes - Please do not copy any content including images without prior consent!

Designed and Hosted by Andy Barnes