Monday, October 31, 2011

Determine which ESXi Host has a .vmdk file locked

I was trying to remove some dead files left over from failed P2V attempts on an ESXi 5.0 host.  The question I have is which host has the file locked, I don’t want to reboot more than is necessary.  I am using iSCSI targets, and this command gives you a list of which Mac address has a file locked

vmkfstools –D /vmfs/volumes/<UUID>/<VMDIR>/<>

I was able to get output that had this in it:

Hostname vmkernel: 17:00:38:46.977 cpu1:1033)Lock [type 10c00001 offset 13058048 v 20, hb offset 3499520
Hostname vmkernel: gen 532, mode 1, owner 45feb537-9c52009b-e812- 00137266e200 mtime 1174669462]

Therefore the offending Mac address is :00:13:72:66:E2:00

I opened my vSphere client and found the offending nic in my  Configuration/Network Adapters by traversing each suspect host.

After rebooting that host, the file lock is gone.

Credit to this article from VMW


Anonymous said...

Man, I owe you a beer. I had a VM that was showing up as invalid and tried everything from restarting services to creating a new VM and attaching the vmdks to it...nothing worked. I never thought something as simple as restarting the host would work but it did! I really do owe you a million thanks. Cheers. said...

Very useful post. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. Really its great article. Keep it up. AdLock Media CPA Network