Remove VM vmx file lock
search cancel

Remove VM vmx file lock

book

Article ID: 378460

calendar_today

Updated On:

Products

VMware vSphere ESX 7.x VMware vSphere ESX 8.x

Issue/Introduction

In the event an ESXi host abruptly shuts down due to hardware failure, rebooting the host may not be an option to release the locks on VM files.

  • vCenter may have attempted to restart the VMs on a different ESXi host due to the vSphere HA event, but could not due to a lock on the VM's "vmx" file.
  • The lock will keep the VM from being able to be registered on a different ESXi host.

Environment

VMware vSphere ESXi 7.0.x

VMware vSphere ESXi 8.0.x

 

Cause

ESXi host unable to reboot and communicate with storage to release locks on VM files.

Resolution

Follow the steps in KB 314365 to confirm the locks are by the failed ESXi host, or if the VM was possibly rebooted and running on a different host.

 

If the locks are still by the failed host, do the following to remove the vmx lock and register the VM on an accessible host.

  • Create directory “bkup” in the VM folder with "mkdir bkup".

  • Move the "####.vmx.lck" lock file(s) with “mv ####.vmx.lck bkup”.

  • Confirm file has been moved and listed in “bkup” folder with “ls -lah bkup”.

  • vCenter may not allow registering the VM on different host with error stating VM with same name already exists.

    • Log into vSphere client of an accessible ESXi host.

    • Register the VM.

    • Once the VM is powered on, the vCenter should see the VM is now registered on different host and update its database with the change.