After transferring and/or trying to restart a VM in ESX you may be presented with the error message “Unable to access a file since it is locked”.
Now what you need to do is work out what is actually locking this file and then (unsurprisingly) find a way to unlock it. Generally the problem will be caused by one of three things.
1. Process Lock: There is a process on the ESX server that still has hold of a file(s) used by the VM. This is one of the most common causes. To resolve this there have been a couple of good VMware Forum postings here and here that have been consolidated to this useful posting over at GabesVirtualWorld.com (*Note: It is worth checking out the comment by Kent at the bottom of the posting). Also, check out Tecumseh’s posting here.
2. Disk Naming Conflict: Two or more disks with the same VMDK name. This can be caused by another disk with the same VMDK file name being referenced by the VM. This may have occurred due to a VM move where the VM used have disks located on different LUN’s or similar which have now been moved onto the same LUN and VM directory. If this is the case rename one of the matching VMDK files (preferably not the one used as the boot drive) and with the VM powered down remove the renamed disk and reattach it (using its new name).
3. Corrupt VMX file: There is a possibility that the VM’s VMX file has corrupted. You can look through the VMX file and try and troubleshoot the issue though it is quite often quicker to recreate a new VMX file. This can be achieved by creating a new VM and attaching the existing disks to it (ie: rather than creating a new VM with new a new disk).
So here are three potential problem areas that you may want to consider when getting a “Unable to access a file since it is locked” within ESX.