VMware vSphere ESXi 7.0.x
VMware vSphere ESXi 8.0.x
VMware horizon
The Purpose of File Locking
To prevent concurrent changes to critical virtual machine files and file systems, ESXi hosts establish locks on these files. In certain circumstances, these locks may not be released when the virtual machine is powered off. As such, the files cannot then be accessed by other ESXi hosts while locked and the virtual machine fails to power on.
Virtual machine files locked during runtime include:
For example:
vmfsfilelockinfo -p /vmfs/volumes/<UUID>/VM1/VM1_1-000001-delta.vmdk -v 192.168.1.### -u [email protected]
vmfsflelockinfo Version 1.0
Looking for lock owners on "VM1_1-000001-delta.vmdk"
"VM1_1-000001-delta.vmdk" is locked in Exclusive mode by host having mac address ['##:##:##:##:##:##']
Trying to make use of Fault Domain Manager
----------------------------------------------------------------------
Found 0 ESX hosts using Fault Domain Manager.
----------------------------------------------------------------------
Could not get information from Fault domain manager
Connecting to 192.168.1.XXX with user [email protected]
Password: *example*
----------------------------------------------------------------------
Found 3 ESX hosts from Virtual Center Server.
----------------------------------------------------------------------
Searching on Host 192.168.1.###
Searching on Host 192.168.1.###
Searching on Host 192.168.1.###
MAC Address : ##:##:##:##:##:##
Host owning the lock on the vmdk is 192.168.1.###, lockMode : Exclusive
Total time taken : 0.27 seconds.
Note: During the life-cycle of a powered on virtual machine, several of its files transitions between various legitimate lock states. The lock state mode indicates the type of lock that is on the file. The list of lock modes is:
lsof | egrep 'Cartel|VM1_1-000001-delta.vmdk'
Cartel | World name | Type | fd | Description
36202 vmx FILE 80 /vmfs/volumes/<UUID>/VM1/VM1_1-000001-delta.vmdk
This shows that the file is locked by a virtual machine having Cartel ID 36202.
esxcli vm process list
This displays information for active virtual machines grouped by virtual machine name and having a format similar to:
Alternate_VM27
World ID: 36205
Process ID: 0
VMX Cartel ID: 36202
UUID: <UUID>
Display Name: Alternate_VM27
Config File: /vmfs/volumes/<UUID>/Alternate_VM27/Alternate_VM27.vmx
………
The virtual machine entry having VMX Cartel ID: 36202 shows the display name of the virtual machine holding the lock on file VM1_1-000001-delta.vmdk, which in this example, is Alternate_VM27.
for i in $(vim-cmd vmsvc/getallvms | grep -v Vmid | awk -F "/" '{print $2}' | awk '{print $1}'); do echo $i && find ./ -iname $i | xargs grep vmdk | grep -Ei VMDKS_TO_LOOK_FOR ; done
Removing the .lck file from VM root directory (NFS only)
Create directory “bkup
” in the VM folder with "mkdir bkup
".
Move the "lck-####" lock file(s) with “mv lck-#### bkup”.
Confirm file has been moved and listed in “bkup
” folder with “ls -lah bkup
”.
Note: VMFS volumes do not have lck files. The locking mechanism for VMFS volumes is handled within VMFS metadata on the volume.
Verify the integrity of the virtual machine configuration file (.vmx)
For more information on checking the integrity of the virtual machine configuration file, see Verifying ESX/ESXi virtual machine file integrity
For related information, see
Opening a Support Request
If the problem persists after completing the steps in this article:
Note: It is possible for a VM to shutdown after consolidation if a lock is obtained during the switchover period between the initial disk and base disk. See Virtual Machine shuts down after a disk consolidation due to a locked file for more details.