A virtual machine (VM) displays a "Consolidation needed" warning, and consolidation tasks fail due to file locks held by external processes or stale sessions. In some scenarios, the VM may enter a power-off state and fail to power back on until locks are released
Virtual machine disks consolidation is needed.Unable to access file since it is locked An error occurred while consolidating disks: Failed to lock the file.OBJLIB-VSANOBJ: VsanObjLock: Could not lock object/vmfs/volumes/<datastore_name>/<vm_name>/vmware.log will have the below events logged in: YYYY-MM-DDTHH:MM:SS In(05) vmx - SnapshotVMX_Consolidate: Starting online snapshot consolidate operation.YYYY-MM-DDTHH:MM:SS In(05) vmx - ConsolidateFillSnapDiskTransferArray: Item 0 source: /vmfs/volumes/vsan:<vsan Datastore UUID>/<VSAN OBJECT ID - VM HOME DIR>/Test-VM-000255.vmdk dest: /vmfs/volumes/vsan:<vsan Datastore UUID>/<VSAN OBJECT ID - VM HOME DIR>/Test-VM.vmdk. Cumulative size of redo logs (including meta-data): 6883860480.YYYY-MM-DDTHH:MM:SS In(05) vcpu-0 - [msg.disklib.numLinks.maxReached] This virtual machine has 255 or more redo logs in a single branch of its snapshot tree. The maximum supported limit has been reached, creating new snapshots will not be allowed. To create new snapshots, please delete old snapshots or consolidate the redo logs.YYYY-MM-DDTHH:MM:SS In(05) vcpu-0 - ConsolidateEnd: Snapshot consolidate complete: Failed to lock the file (5).
/var/run/log/vmkernel.log, below entries can be seen during the consolidation attempt: YYYY-MM-DDTHH:MM:SS cpu26:######## opID=74f54281)DLX: 2650: vol '<VSAN OBJECT ID - VM HOME DIR>', lock at 125706240: Lock type: 10C00001. Read Lock(s) held on a file on volume <VSAN OBJECT ID>. numHolders:1 gblNumHolders:0,$YYYY-MM-DDTHH:MM:SS cpu26:######## opID=74f54281)[type 10c00001 offset 125706240 v 13942, hb offset 3215360gen 263, mode 2, owner 00000000-00000000-0000-000000000000 mtime 11919512num 1 gblnum 0 gblgen 0 gblbrk 0] alloc owner 0YYYY-MM-DDTHH:MM:SS cpu26:######## opID=74f54281)DLX: 2651: vol '<VSAN OBJECT ID - VM HOME DIR>', lock at 125706240: Lock type: 10C00001. owner(s) MAC: ##:##:##:##:##:##:YYYY-MM-DDTHH:MM:SS cpu26:######## opID=74f54281)[type 10c00001 offset 125706240 v 13942, hb offset 3215360gen 263, mode 2, owner 00000000-00000000-0000-000000000000 mtime 11919512num 1 gblnum 0 gblgen 0 gblbrk 0] alloc owner 0YYYY-MM-DDTHH:MM:SS cpu26:######## opID=74f54281)Fil3: 5033: Lock failed on file: .<VSAN OBJECT ID - VM HOME DIR>.lck on vol '##########' with FD: <FD c288 r4>
One or more snapshot disks in the VM's snapshot chain remain locked by an external process instead of the VM's own .vmx process
This issue occurs when a snapshot-based backup solution fails to release a read-only lock on a VM's snapshot flat file. During the backup process, the proxy VM provisions the snapshot disk in read-only mode, which causes the ESXi host to place a lock on the file.
If the backup job does not release this lock upon completion, snapshot consolidation tasks will fail, as consolidation requires that no process other than the VM's own .vmx process holds a lock on the snapshot files. This leads to the snapshot chain growing continuously until it reaches the maximum limit of 255 snapshots.
Determine the locks held on the files by following the below KBs.
Investigating Virtual Machine file locks on ESXi Host(s)
Investigating virtual disk file locks on vSAN
To resolve snapshot consolidation failures caused by stale file locks from backup proxies, follow these steps to identify and release the locked files.
I. Identify the Lock Source
lsof command to identify which process is holding the lock.vmx process on this secondary host, it confirms that a backup proxy VM (or another VM) has the disk mounted.lsof and filter for the specific snapshot file names.vmx PID that does not belong to the impacted VM.II. Release the File Lock
IMPORTANT
Before proceeding with de-provisioning:
III. Workaround: Power Cycle the Proxy
If the lock persists after de-provisioning attempts:
.vmx file).IV. Consolidate Snapshots
After the lock is released, return to the impacted VM in vCenter and initiate the Consolidate task.
Note: Snapshot consolidation will only succeed when the only process holding a lock on the snapshot files is the vmx process of the impacted VM itself.
If the "lsof" command shows the lock is held by hostd process, restart hostd process to release the lock.
Virtual machines on NFSv3 datastores might fail due to a failed snapshot consolidation during backup.
Stale file locks on VMDKs left by 3rd party backup solutions