Problem:
Unable to delete an inaccessible datastore
I was switching my storage array, so I migrated the VMs from that old datastore/storage to a new datastore/storage.
The old datastore was shared by 3 ESXi 6.7 hosts, with no cluster. After migrating the VMs and unmount/delete the datastore, it was still presented in two of the ESXi hosts and was marked as Inaccessible. I am pretty sure that I did something wrong, but don’t know what.
Attempting a few times to delete the datastore keep popping up the error below:
I tried and check:
- There was no VM or template allocated in the old datastore.
- There was no files, snapshots or templates. In fact, the datastores show 0 B of capacity.
- Storage I/O Control (SIOC) wasn’t enabled on the datastore.
- Access via SSH to delete the datastore from there, but these two datastores were not listed.
- This wasn’t an Orphaned Datastore, the Delete Datastore option wasn’t grayed out, it just didn’t work.
- I tried more options. See resources.
Solution:
Yet another "simple" solution. Restart management agents in the ESXi host, or restart the ESXi host itself.
To restart management agents on the ESXi 6.7 login into SSH as root and run the command below:
services.sh restart
You can also restart the management agents from the ESXi host console.
My major problem was that one of these two ESXi hosts was hosting the vCenter Server and all other servers of the infrastructure. This is not suitable nor friendly for productions environments but was the only solution for me.
Besides users being more careful when removing datastores, I hope VMware had another solution to solve this kind of issue.
Resources:
https://kb.vmware.com/s/article/2004605
https://communities.vmware.com/thread/571912
https://communities.vmware.com/message/2662944#2662944
https://community.spiceworks.com/topic/1972169-remove-inactive-datastore-from-esxi