Unmounting or removing a datastore from vCenter Server or an ESXi host fails with an error indicating the resource is in use. This behavior persists even when no active Virtual Machines are running on the storage.
Attempt to unmount an NFS or VMFS datastore fails.
The vSphere Client displays the error: Unmount datastore failed! The resource <Datastore_Name> is in use.
The datastore is reported as inaccessible or offline, but remains in the inventory.
One or more templates are visible in the datastore Summary tab.
VMware vSphere ESXi 7.x
VMware vSphere ESXi 8.x
vCenter Server maintains logical locks and dependencies on datastores hosting registered inventory objects (VMs, templates, or ISOs). These locks prevent accidental data loss. If a pointer to a template remains in the vCenter database, the unmount operation will fail.
Unregister the template from the vCenter inventory to release the logical lock before attempting the unmount operation.
Option 1: Unregister via vSphere Client
Navigate to the affected datastore in the vSphere Client.
Select the VMs tab.
Change the filter/view from Virtual Machines to VM Templates.
Right-click the template and select Remove from Inventory.
Confirm the removal by clicking Yes.
Perform the datastore unmount or deletion operation.
Option 2: Alternative Workaround
If removing from inventory is not preferred, migrate the object:
Convert the template to a Virtual Machine.
Migrate the Virtual Machine to a different datastore.
Convert the Virtual Machine back into a template.