When trying to delete the VMFS datastore the following error is seen - "An error occurred during host configuration. Operation failed, diagnostics report: Unable to query live VMFS state of volume.: No such file or directory".
The datastore does not appear as "Inaccessible" and has the mount and unmount options greyed out and unclickable:
The datastore does not appear to be mounted on any hosts when checked from vSphere Client > Datastore > Configure > Connectivity and Multipathing and also at vSphere Client > Datastore > Hosts:
The "Device backing" tab, does not show details of the LUN on which this VMFS datastore resides:
The LUN backing this datastore is present on the ESXi host but shows as "Not consumed" although the VMFS partition exists. Rescanning storage does not change this state.
VMware ESXi 8.x
LUN backing the datastore is part of replication pair at storage end. (Not SRM with array based replication)
The VMFS datastore does not appear as "Inaccessible" although it is not mounted on any hosts, is because the LUN backing this datastore is in a Write-Disabled mode, after reversing the replication from Storage DR solution end.
During the Storage DR activity, the VMs on the datastore were powered OFF but not un-registered. The replicated LUN pair was mounted as a datastore at the DR end and the replication reversed.
This causes the LUN on the current site to go to a Write-Disabled state, due to which the VMs that are still registered from the datastore to go inaccessible and the LUNs show as "Not consumed".
This also causes the datastore to not appear as mounted on any hosts.
Due to this, the options to mount or unmount the VMFS datastore gets disabled and greyed out.
Also the deletion option fails and gets greyed out as well.
This is an improper way of performing the Storage DR activity. The VMs registered from the datastore should be first unregistered and then the datastore unmounted, before reversing the replication from storage end.
Due to the inaccessible VMs remaining registered on the vSphere Inventory, the VMFS datastore entry also remains.
To resolve this issue:
Un-register the inaccessible VMs from the vSphere inventory for the datastore with this issue.
As soon as all the inaccessible VMs from the datastore are un-registered the datastore entry will be automatically removed from the vSphere client.
For future storage DR activity ensure that the VMs on the datastore are powered OFF, un-registered and then the VMFS datastore unmounted, prior to reversing the replication. For more details refer to the storage array vendor's documentation for the respective Storage DR solution.