Vmware – Unable to operate a ESX host with locked disk

Background – No operation can be performed on an ESX host and you may see files are locked by other processes.

Solution

Determine which ESXi/ESX host has a locked or rogue file.

* First login to the local tech support mode console on the host.
* Use the command vmkfstools to obtain the lockstatus of the file.

# vmkfstools -D /vmfs/volumes/LUN/VM/disk-flat.vmdk

You would see a similar output as below,

Lock [type 10c00001 offset 54009856 v 11, hb offset 3198976
gen 9, mode 0, owner 4655cd8b-3c4a19f2-17bc-00126e808070 mtime 114]
Addr <4, 116, 4>, gen 5, links 1, type reg, flags 0, uid 0, gid 0, mode 600
len 5368709120, nb 0 tbz 0, cow 0, zla 3, bs 1048576

Look for the output logged to the vmkernel, messages, or vmkernel.log files to see the complete output.

Where:

The owner 4655cd8b-3c4a19f2-17bc-00145e808070 indicates that the MAC address of the ESXi/ESX host locking the file is 00:12:5E:80:80:70.

If the owner has the entry 00000000-00000000-0000-000000000000 it indicates that the file has either a read-only lock or a multi-writer lock or there is no lock on the file.

Below are the modes indicating the type of lock that is on the file.

mode 0 = no lock
mode 1 = is an exclusive lock (vmx file of a powered on VM, the currently used disk (flat or delta), *vswp, etc.)
mode 2 = is a read-only lock (e.g. on the ..-flat.vmdk of a running VM with snapshots)
mode 3 = is a multi-writer lock (e.g. used for MSCS clusters disks or FT VMs).

* Now identify the which ESXi/ESX host has a network adapter with this MAC address 00:12:5E:80:80:70. Use the command esxcfg-nics -l from the command line to obtain the MAC address.

* use the below command on the host holding the lock to determine the process which is holding the lock:

# lsof |grep /vmfs/volumes/LUN/VM/disk-flat.vmdk

Some known issues resulting in lock,

  • If the process holding the lock is ESXi/ESX management agent then restarting the management agents may free up the lock.
  • Backup program using snapshots or the VMware Backup API to backup virtual machines mostly brings about this issue, Turn off or restart the backup server to see if that helps clear the lock.
  • vMotion the virtual machines running on the ESXi/ESX host that created the lock to another ESXi host as a last resort.
  •  Terminate the ESXi/ESX host that created the lock by either restarting the host or running the below command:
    # vm-support -X

If you feel this is tricky and you can’t take any risk, our Web Hosting experts can assist you in getting this fixed at a pocket-friendly price. All you need to do is to contact us and we’ll take care of the rest.

Here is a related post you maybe interested in: Virtual Machine Cannot Start (Vmware) – ESX/ESXi – 5.0

Written by actsupp-r0cks