Friday, 11 October 2019

Disk lock error in VMware


Issue :

You encounter below error while consolidating VM or powering ON a VM :

An error occurred while consolidating disks: msg.snapshot.error-DISKLOCKED

An error occurred while consolidating disks: msg.fileio.lock.

Consolidation failed for disk node 'scsi0:0': msg.fileio.lock

Unable to access a file filename since it is locked

Unable to access virtual machine configuration

A general system error occurred: vim.fault.G-enericVmC-onfigFault

Cause :
  • The common reason would be a powered on virtual machine contains locks on all files in use by the owning ESXi host to facilitate read and write access.
  • Other locks may be created by hot-adding disks to snapshot based backup appliances during the backup process.
  • Failure to create a lock / start a virtual machine can occur if an unsupported disk format is used or if a lock is already present.
Solutions

Solution 1 : vMotion the virtual machine

vMotion the virtual machine to a different host and try to consolidate/power on.

If the above is not successful storage vMotion the virtual machine to a different datastore.

Solution 2 : Restart the management agents on the particular host the VM is running on.

SSH into the ESXi host and run the command services.sh restart

Solution 3 : Restart the ESXi host.

Shutdown the affected VM. vMotion all other working VMs to a different host and restart the ESXi host.

Solution 4 : Unregister the virtual machine from the host & re-register the virtual machine on the host holding the lock.

Solution 5 : Clone the VMDK files to a different datastore using PowerCLI, create new Virtual Machine, attach the cloned VMDKs’.