Run this command to check the VMkernel logs to see if the file is in use and to identify the owner:
vmkfstools -D diskname-flat.vmdk
Here is a sample command and the output it writes to the VMkernel log:
vmkfstools -D /vmfs/volumes/xxxxxxxx-xxxxxxxx-xxxx-xxxxxxxxxxxx/VM/virtualdisk-flat.vmdk
YYYY-MM-DDTHH:MM:SS esxhost vmkernel: 10:20:00:22.731 cpu5:1040)FS3: 130: <START virtualdisk-flat.vmdk>
YYYY-MM-DDTHH:MM:SS esxhost vmkernel: 10:20:00:22.731 cpu5:1040)Lock [type 10c00001 offset 48226304 v 386, hb offset 3558400
YYYY-MM-DDTHH:MM:SS esxhost vmkernel: gen 37, mode 0, owner 00000000-00000000-0000-000000000000 mtime 221688]
YYYY-MM-DDTHH:MM:SS esxhost vmkernel: 10:20:00:22.731 cpu5:1040)Addr <4, 96, 156>, gen 336, links 1, type reg, flags 0x0, uid 0, gid 0, mode 100600
YYYY-MM-DDTHH:MM:SS esxhost vmkernel: 10:20:00:22.731 cpu5:1040)len 12884901888, nb 6144 tbz 0, zla 3, bs 2097152
YYYY-MM-DDTHH:MM:SS esxhost vmkernel: 10:20:00:22.731 cpu5:1040)FS3: 132: <END virtualdisk-flat.vmdk>
In this example, 00000000-00000000-0000-000000000000 indicates that the file is not in use or locked by another owner.
After the virtual machine is powered on, the output written to the VMkernel log appears similar to:
YYYY-MM-DDTHH:MM:SS esxhost vmkernel: 11:13:16:44.102 cpu3:1041)FS3: 130: <START virtualdisk-flat.vmdk>
YYYY-MM-DDTHH:MM:SS esxhost vmkernel: 11:13:16:44.102 cpu3:1041)Lock [type 10c00001 offset 69419008 v 436, hb offset 3200512
YYYY-MM-DDTHH:MM:SS esxhost vmkernel: gen 40, mode 1, owner 4a84acc3-786ebaf4-aaf9-xxxxxxxxxxxx mtime 271]
YYYY-MM-DDTHH:MM:SS esxhost vmkernel: 11:13:16:44.102 cpu3:1041)Addr <4, 153, 112>, gen 379, links 1, type reg, flags 0x0, uid 0, gid 0, mode 100600
YYYY-MM-DDTHH:MM:SS esxhost vmkernel: 11:13:16:44.102 cpu3:1041)len 8388608, nb 8 tbz 0, zla 1, bs 1048576
YYYY-MM-DDTHH:MM:SS esxhost vmkernel: 11:13:16:44.102 cpu3:1041)FS3: 132: <END virtualdisk-flat.vmdk>
The owner is 4a84acc3-XXXXXX-XXXXXX-XXXXXXXXX. The part highlighted in red is the MAC address of vmnic0 from the host that has the lock.