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, users 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. The search can be automated 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 the user is trying to delete.
Note: This command needs to be run 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 locating the virtual machine which has mounted the .vmdk, remove it. Select that virtual machine and go to Edit Settings > Hard Disk > Remove.
After the .vmdk file has been removed from the backup virtual machine, the file using normal methods can be deleted.
NOTE: Before deleting the VM/VMDK. Make sure the VM or VMDK which is being deleted is not part of backup or added to proxy server.