Your last resort for “Unable to access file unspecified filename since it is locked”

This issue has been discussed many times in the last 4 years, but still, I believe no existing blog post is the complete solution. So here’s my addition :)
Since I’m not going to describe every step in detail, I hope this blog post is your last resort. You then are completely into VMWare ESX troubleshooting and all related tools, like WinSCP and Putty :)

In an environment with backup and recovery software, you may face problems with snapshots that are not deletable. In my case, this was the Consolidated Helper- 0VMWare ESX 4.1 Consolidated helper 0
When you try to delete the snapshot, you get an error: Unable to access file unspecified filename since it is locked

"VMWare

Before entering the troubleshooting rollercoaster, you should always try to create an additional snapshot on the VM, and then try to “Delete All” snapshots. This may fix your problem instantly. If not, continue reading.

So, obviously some backup software has a reservation on your VM.

  1. Open a WinSCP session to a ESX host and navigate to the datastore of the VM. You can find the datastore in the VSphere client in the Summary tab of the VM. Your location is typically \root\vmfs\volumes\YOUR_DATASTORE\YOUR_VMNAME
  2. Open the VMware.log file with Notepad. Look for the phrase “Failed to lock the file”. There you’ll find the vmdk file that is actually locked. For example srv-myserver-0001-flat.vmdk
  3. To find out the machine(s) that is locking the files, run the following command: vmkfstools -D srv-myserver-0001-flat.vmdk
    You’ll get something like below. Note: the bold highlighted text is the MAC Address of the machine that is locking your VMDK![root@test-esx1 testvm]# vmkfstools -D srv-myserver-0001-flat.vmdk
    Lock [type 10c00001 offset 45842432 v 33232, hb offset 4116480 gen 2397, mode 2, owner 00000000-00000000-0000- 000000000000mtime 5436998]  <—– — — — –  MAC address  of lock owner RO Owner[0]  
    HB offset 3293184 4f284470-4991d61b-4b28-001a64c335dc  <———————– — — –  MAC address  of read-only lock owner
    Addr <4, 80, 160>, gen 33179, links 1, type reg, flags 0, uid 0, gid 0, mode 100600 len 738242560, nb 353 tbz 0, cow 0, zla 3, bs 2097152
  4. In the example above, the ReadOnly lock owner has MAC address 001a64c335dc. This is the MAC address of an ESX host. On this particular host runs a VM that is causing the problems.
    To find out what ESX host has the MAC Address 001a64c335dc, you should open an SSH connection to the ESX host with Putty and run the following command on each ESX host:
    [root@my-esx-host~]# ifconfig |grep -i hw
    vmnic0    Link encap:Ethernet  HWaddr BC:50:5B:BE:3D:36
    vmnic1    Link encap:Ethernet  HWaddr BC:50:5B:BE:3D:38
    vmnic2    Link encap:Ethernet  HWaddr BC:50:5B:BE:3D:3A
    vmnic3    Link encap:Ethernet  HWaddr BC:50:5B:BE:3D:3C
    vmnic4    Link encap:Ethernet  HWaddr 00:1a:64:c3:35:dc
    vmnic5    Link encap:Ethernet  HWaddr 00:1B:21:46:3F:89
    vmnic6    Link encap:Ethernet  HWaddr 00:1B:21:46:3F:8C
  5. Now you know what host is locking the vmdk file. Your last step would be to open “Edit Settings” of every VM on that particular host. One VM will have a lot of Harddisks attached. Clicking on the harddisk will identify the associated VM. Select the hard disk, and click Remove. Verify you only remove the disk, and do NOT DELETE it :)

    VMWare ESX 4.1 Remove harddisk from VM
    VMWare ESX 4.1 Remove harddisk from VM

  6. Now you can delete the snapshots of the VM

Cheers! :-)

I’m aware that this article is a quick wrap up and may lead to some confusion. Feel free to post comments or ask questions if you feel the need…

0 0 vote
Article Rating
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Josh Willett

Thanks for this very good and easy to follow article.
I have a further problem though, the MAC address responsible for the lock is for a NIC on a host that is no longer being used.

1
0
Would love your thoughts, please comment.x
()
x