Failed to lock the file - Continue...

In our day to day operational activity into the vCenter we usually encounter with issue, like unable to power on the VM. VM failed to lock the file or file has been locked.

To resolve the issue, I have some very usefull command which you can execute to immediatly idently where the .vmdk is being locked.

As most of you know that vmkfstools -D is used to identify the lock on the .vmdk  where its gives the mac address of the VM or Host where the lock exist and we can identify the lock from Esxcli.

ie (vmkfstools -D /vmfs/volumes/abcd.vmdk)

Apart from this there is one beautiful command which we can use to identify the lock on the .vmdk.

The command to identify the lock is "vmkfsfilelockinfo -p (location of .vmdk)

vmfsfilelockinfo -p (/vmfs/volumes….)

  • You see ouput similar to:

    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 ['xx:xx:xx:xx:xx:xx']
    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 with user administrator@vsphere.local
    Password: xXxXxXxXxXx
    Found 3 ESX hosts from Virtual Center Server.
    Searching on Host
    Searching on Host
    Searching on Host
    MAC Address : xx:xx:xx:xx:xx:xx

    Host owning the lock on the vmdk is, 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:
  • mode 0 = no lock
  • mode 1 = is an exclusive lock (vmx file of a powered on virtual machine, the currently used disk (flat or delta), *vswp, and so on.)
  • mode 2 = is a read-only lock (For example on the ..-flat.vmdk of a running virtual machine with snapshots)
  • mode 3 = is a multi-writer lock (For example used for MSCS clusters disks or FT VMs) 

Here this command will give you exect answer that lock is on Host whose IP is

Verify the Host and identify it. possibility it require a reboot to release the lock.

Happy Sharing... :)


Popular posts from this blog

VM Creation Date & Time from Powercli

Could not connect to one or more vCenter Server systems: https://FQDN:443/sdk

Changing the FQDN of the vCenter appliance (VCSA)