I recently had an issue powering on a VMware guest after a HA problem with one of my host, when I attempted to power on the guest I received the message “Failed to lock the file” in vCentre.
Within the vmware.log file for the guest it gave the name of the file that was locked.
- On one of my hosts I enabled and logged on as root using SSH https://kb.vmware.com/s/article/2004746
- Running the command vmfsfilelockinfo -p with the full path of the locked file from the vmware.log file showed which host was locking the file.
- I then put the host identified by vmfsfilelockinfo into maintenance mode and simply restarted it
- The lock was then cleared and I could power on the guest
1 thought on “VMware – Failed to lock the file”
In my case, there was a lot of vmdk with corrupted snapshots (around 30 vmdk). I use this to verify by a loop:
“for i in $(ls *.vmdk);do vmfsfilelockinfo -p $i|grep “is locked”;done”
After reboot the host, VM power on properly, I consolidate the disk without errors and life goes on!!!!
Thanks a lot!!!!!