Some virtual machine backup solutions, as part of their backup approach, mount a virtual machine's virtual disk file (.vmdk) to a virtual machine other than the one the .vmdk originally belonged to. When this happens, the .vmdk whose parent virtual machine had been deleted is still mounted to a running virtual machine. Even though the .vmdk file is not technically open, it is mounted to the backup solution's virtual machine.
To resolve this issue, you must locate the virtual machine that has this .vmdk mounted and then unmount it. To do so:
- Search for references to the .vmdk file in the settings files (.vmx files) of the other virtual machine's on the datastore. You can automate the search with a command like this:
find /vmfs/volumes/* -name *.vmx -exec grep -Hi <name-of-the-file.vmdk> {} \;
where <name-of-the-file.vmdk>
is the .vmdk you're trying to delete.
Note: You need to run this command from each host that can see the datastore, because the .vmx file is locked on all hosts except the one on which it is running.
- After you have located the virtual machine which has mounted the .vmdk, remove it. Select that virtual machine and go to Edit Settings > Hard Disk > Remove.
After you have removed the .vmdk file from the backup virtual machine, you can delete the file using normal methods.
NOTE: Before deleting the VM/VMDK. Make sure the VM or VMDK which you are deleting is not part of backup or added to proxy server.