VM shows the alert under 'Summary' in vSphere Client: "Virtual machine disks consolidation is needed"
Complete error that is reported is as follows:
One or more disks on the VM shows following error in 'Tasks'
Steps to Validate
/var/run/log/hostd.log reports the same error:
2025-02-11T23:09:33.921Z verbose hostd[2101541] [Originator@6876 sub=Vigor.Vmsvc.vm:/vmfs/volumes/xxxxxxxx-xxxxxxxx-xxxx-xxxxxxxxxxxx/<VM-Name>/VM.vmx opID=esxui-d63b-795c] Consolidate Disks message: Consolidation failed for disk node 'scsi0:1': Failed to lock the file. --> Consolidation failed for disk node 'scsi0:2': Failed to lock the file. --> Consolidation failed for disk node 'scsi0:11': Failed to lock the file. --> Consolidation failed for disk node 'scsi0:12': Failed to lock the file. --> Consolidation failed for disk node 'scsi0:15': Failed to lock the file. --> An error occurred while consolidating disks: Failed to lock the file.
Environment
vSphere ESXi 7.x
vSphere ESXi 8.x
Cause
This issue is observed when one or more disks or their snapshots are held with the lock by processes other than VM's VMX process.
For e.g. Backup Proxy server or ESXi hosting the VM.
Resolution
Check what holds the lock on the disk or its snapshot running following command:
# vmfsfilelockinfo -p "<VM-flat.vmdk>
Refer article 313833 for more details on Virtual machine file lock and its troubleshooting.
The output of the above command looks like this:
vmfsfilelockinfo version 2.0 Looking for lock owners on "VM-flat.vmdk" 'VM-flat.vmdk" is locked in Exclusive mode by host having mac address ['aa:bb:cc:xx:yy:zz'] total time taken : 0.7097157165408134 seconds.
Here, aa:bb:cc:xx:yy:zz is the MAC address of a NIC of the host holding the file lock.
On the identified host, check for the processes that holds the lock and release it by killing the stale process or closing the open file. More details on 313833.
If the host that holds the lock is a backup proxy server, ensure the snapshot disk file is unmounted from it.
If the lock on the disk is held by the ESXi host on which VM is hosted, following steps could be taken (in the given sequence):
Restart the hostd service using command: # /etc/init.d/hostd restart
If the above step doesn't help, perform the host reboot to clear the stale locks.