Cannot delete a vsan folder or file, error "Cannot delete file [vsanDatastore] <Namespace UUID>"
book
Article ID: 412925
calendar_today
Updated On:
Products
VMware vSAN
Issue/Introduction
When attempting to delete a folder or file such as VMDK in the vCenter gui it fails with "Cannot delete file [vsanDatastore] <Namespace UUID> / <Namespace UUID/######.vmdk> "
Environment
VMware vSAN (all versions)
Cause
When a folder/file is associated with a registered/powered on VM, vCenter will not let you delete any objects that are associated with that VM to prevent unexpected data/loss.
Resolution
If you are attempting to delete a Folder find the VM that is associated with it and determine if it needs to be deleted. If the VM needs to be deleted form the environment please follow our documentation on how to Remove Virtual Machines from a Host in the VMware Host Client.
If you are attempting to delete a file such as a VMDK find the VM that is associated with the object.
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:
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.
If you are not able locate the VM or delete the VM from disk please open a case with VMware Support for further investigation.