When attempting to consolidate snapshots for a virtual machine, the task fails with the following error:
Virtual machine disks consolidation failed - "Unable to access file /vmfs/volumes/<Datastore-UUID>/<VM-Name>/<VM-Name>_X.vmdk since it is locked"
Symptoms:
Example vmkernel log entries(vmkernal.log):
NFSLock: oid for existing li(lockfile .lck-500000000 file VMNAME-flat.vmdk) matches for VMNAME-flat.vmdk
NFSLock: oid for existing li(lockfile .lck-da00000000 file VMNAME_4-flat.vmdk) matches for VMNAME_4-flat.vmdk
YYYY-MM-DDTHH:MM:SS.00Z In(182) vmkernel: cpu92:13405967 opID=7c6756a8)NFSLock: 2456: oid for existing li(lockfile .lck-500000000 file VMNAME-flat.vmdk) matches for VMNAME-flat.vmdk
YYYY-MM-DDTHH:MM:SS.00Z In(182) vmkernel: cpu91:2099015 opID=b28b25af)NFSLock: 2456: oid for existing li(lockfile .lck-da0000000 file VMNAME_4-flat.vmdk) matches for VMNAME_4-flat.vmdk
YYYY-MM-DDTHH:MM:SS.00Z In(182) vmkernel: cpu54:13406290)NFSLock: 2456: oid for existing li(lockfile .lck-da00000000 file VMNAME_4-flat.vmdk) matches for VMNAME_4-flat.vmdk
YYYY-MM-DDTHH:MM:SS.00Z In(182) vmkernel: cpu60:13406290)NFSLock: 2456: oid for existing li(lockfile .lck-500000000 file VMNAME-flat.vmdk) matches for VMNAME-flat.vmdk
VMware ESXi 8.0
The issue occurs when stale NFS locks remain on the VMDK files on the same ESXi host where the VM resides.
This typically happens when the hostd or vpxa management agents on the host enter a hung or stale state, preventing the lock from being released or re-acquired by consolidation tasks.
As a result, the consolidation process cannot obtain exclusive access to the VMDK files.
1. Identify the locking host
2. Place the locking ESXi host into maintenance mode
Command: esxcli system maintenanceMode set --enable true
3. Restart management agents on the locking host
Command:
/etc/init.d/hostd restart
/etc/init.d/vpxa restart
4. Retry disk consolidation from the vSphere Client:
5. Exit maintenance mode after verification:
Command: esxcli system maintenanceMode set --enable false
Related Articles: