VMware Cloud Community
hmjones8
Contributor
Contributor

Locked File on DataStore - How to find out which VM has opened access to this file?

How can I find out which VM has locked access to an iso file located on one of my datastores? I'm assuming one could do this from the services console? I'm trying to delete the file and I get an error stating the file is busy. Example: rm /vmfs/volumes/xyz-datastore/win2k3.iso (error: file is locked/busy)

This is a multi-esx host cluster. There are 4 servers. I'm willing to go to each one to run a command to see what vm has the file locked.

Thanks,

Heath.

Tags (3)
0 Kudos
1 Reply
BenConrad
Expert
Expert

On each host you can try running 'lsof | grep -i your_iso_file_name" or you can also try 'vmkfstools -D /path/to/file', and look at the vmkernel log for the following message:

Dec 17 15:45:38 YourServerName vmkernel: gen 56971, mode 1, owner 4909d046-a45dad72-a8b8-0017a48e5ab4 mtime 4151275]

Then you can run ifconfig on each host to see which host has the mac address above (0017a48e5ab4):

ifconfig -a | grep -i 5A:B4

vmnic0 Link encap:Ethernet HWaddr 00:17:A4:8E:5A:B4

Ben

0 Kudos