TimothyGaray
Contributor
Contributor

Unable to access a file since it is locked (running ESXi)

Jump to solution

I did manage to workaround this issue by restarting the ESXi host so this isn't critical.

I had a case where I could not start a VM because it's files were still locked by a process running on the ESXi Host that was originally running the VM.

I know with regular ESX hosts, there is a procedure to kill the process that still has the files locked. However, with ESXi I do not have a console to login to.

Besides rebooting the physical ESXi host machine, how can you find a process and terminate it on an ESXi host that has VM files locked?

Thanks!

-Tim

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
kjb007
Immortal
Immortal

You don't have to reboot the ESXi host, but you will need to use the UNSUPPORTED shell as Nick stated. Once you do, you can use ps to find the process, and kill to kill the process. You can enable ssh as well, but that would require you to get to the UNSUPPORTED console first and edit the /etc/inetd.conf.

You can see here to get into the support shell:

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB

View solution in original post

0 Kudos
7 Replies
nick_couchman
Immortal
Immortal

I think rebooting the ESXi host is the only way, unless you use the UNSUPPORTED console/SSH login. Then you may be able to kill the processes in a similar fashion to ESX. Also, you might check out the RCLI tools and see if the utility used in ESX to kill those processes is present in those tools. That was you could do it remotely without having to go into an unsupported mode.

kjb007
Immortal
Immortal

You don't have to reboot the ESXi host, but you will need to use the UNSUPPORTED shell as Nick stated. Once you do, you can use ps to find the process, and kill to kill the process. You can enable ssh as well, but that would require you to get to the UNSUPPORTED console first and edit the /etc/inetd.conf.

You can see here to get into the support shell:

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
0 Kudos
TimothyGaray
Contributor
Contributor

I did not find any commands as part of the RCLI that would help.

0 Kudos
TimothyGaray
Contributor
Contributor

I was able to get into the unsupported console. It looks like the commands ps and kill both work but lsof does not.

0 Kudos
kjb007
Immortal
Immortal

The shell you log into in ESX is not a full-blow shell, so the commands you can run are limited. If a vm is running on that particular ESX host, then you can be sure that the disk and log and swap files will be in use, but sometimes the vm gets in a weird state, and the files are locked, so a quick ps and kill are your only options.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
0 Kudos
mkuzma
Contributor
Contributor

Well in my case, the VM was in the restart loop untill it crashed, but the lock still remains. However no running process is using the file. So I have now locked VMDK file.

0 Kudos
jakesterpdx
Contributor
Contributor

I ran into a similar issue yesterday. I triggered it, bizarrely, by trying to make an ISO file on a network share available to a VM. It killed the VM dead, instantly. We couldn't ping it, couldn't click on the Console tab without hanging the vSphere client. I tried initiating a forced shutdown on the VM, and it hung at 95%. Here's where I made problems much worse for myself by resetting the management agents by directly logging into the host console. That's what caused the .vmx, .vmdk, and .vswp files to lock. I had to reboot the host, and then everything was fine.

The next day, because I'm an idiot I guess, I tried the exact same thing: I tried to make an ISO file on a network share available to a VM. Again the VM dead instantly, and again I tried shutting it down, and again it hung at 95%. However this time I happened upon a simple fix for the 95% hang: I killed a vmware process (sorry, don't remember which one) that was running on the machine that I had used to try to connect the ISO. The 95% instantly went to 100%, and I could start the VM back up without rebooting the host.

0 Kudos