ESX Error: unable to access file since it is locked


While attempting to attach a VMDK to a Virtual machine I encountered this message:

    Unable to access file <unspecified filename> since it is locked

Notes:

  • ESX 4.0 Update 2
  • vCenter 4.0
  • The point of attaching the VMDK to another VM was to troubleshoot an issue with an auto-generated AutoUnattend.xml file used during the installation of Windows Server 2008


In the past I have been able to attach hard drive files (VMDK) using this process:

  1. Right click on the VM and select Edit Settings
  2. Click the Add button
  3. Pick Hard Drive / Hard disk
  4. Navigate to an existing virtual hard drive
  5. Close out of the add wizard and the edit settings page.

When this process failed I tried a few other things which did not work:

  • Inflate the disk, which failed with the message:
           A general system error occurred failed to lock the file
  • Add / remove Snapshots to the virtual machine the VMDK originally belonged to
    • While I was able to take & remove the snapshots, this had no effect
  • Download the VMDK for analysis in a different environment
    • When I attempted to download the file, I got a "general error" message

What I eventually found out was that someone had attached the VMDK to a different virtual machine. Once I removed it from that other VM, I was able to attach it to my virtual machine with no trouble