- Advertisement -
There are a lot of times when I am working in the home lab and removing things and adding things, changing hardware, etc and you get things in a funky state when it comes to datastores and other configuration. I wanted to walk through with you guys removing an inaccessible VMware as this is probably something you will need to do not only in the home lab but at some point, in production.
What is an inaccessible datastore?
An inaccessible datastore is exactly what its name suggests—it is a datastore that cannot be accessed. As shown in the image below, an inaccessible datastore is identified in the storage tab of the vSphere Client. It appears in italics, with the designation (inaccessible) next to its name.
- Advertisement -
You might expect to be able to right-click on the datastore and select an option like “Remove from Inventory.” However, this option is typically greyed out. Let’s explore how we can forcibly remove it.
![Viewing an inaccessible datastore in vmware vsphere client](https://www.virtualizationhowto.com/wp-content/uploads/2024/08/viewing-an-inaccessible-datastore-in-vmware-vsphere-client.png)
Using the vCenter MOB interface
Let’s see if we can use the vCenter MOB interface (https://<your vcenter address/mob) to remove the inaccessible datastore. Once logged in, select the content option in mob.
![Select the content option in mob](https://www.virtualizationhowto.com/wp-content/uploads/2024/08/select-the-content-option-in-mob.png)
Next, select the Datacenters option.
![Selecting the root folder in the vcenter server mob interface](https://www.virtualizationhowto.com/wp-content/uploads/2024/08/selecting-the-root-folder-in-the-vcenter-server-mob-interface.png)
Next, select the childEntity which for me is CloudLocal my datacenter name.
![Select the child entity in mob](https://www.virtualizationhowto.com/wp-content/uploads/2024/08/select-the-child-entity-in-mob.png)
Under datastore you will see the datastore in question listed. Click the link next to the datastore.
![Under datastores we see the datastore in question](https://www.virtualizationhowto.com/wp-content/uploads/2024/08/under-datastores-we-see-the-datastore-in-question.png)
Now we have several methods available to us. We want to use the DestroyDatastore option to see if we can get rid of the entry that way.
- Advertisement -
![Selecting the destroydatastore option](https://www.virtualizationhowto.com/wp-content/uploads/2024/08/selecting-the-destroydatastore-option.png)
When you click it, you will see the below screen. Here we click Invoke Method.
![Invoke the method for destroying the datastore](https://www.virtualizationhowto.com/wp-content/uploads/2024/08/invoke-the-method-for-destroying-the-datastore.png)
Ah, now we are seeing the reason why the datastore won’t go away. We are getting a ResourceInUse error.
![Resource in use is reason the datastore won't go away](https://www.virtualizationhowto.com/wp-content/uploads/2024/08/resource-in-use-is-reason-the-datastore-wont-go-away.png)
Resource in use – what?
We’re finally uncovering why the datastore remains inaccessible—it’s because a resource is still attached to it. Back when the datastore was part of the inventory and functioning properly, a vCLS VM was using it. However, when the datastore became inaccessible (after I removed the NVMe drive), the vCLS VM got stuck in the inventory in a disconnected state.
![A vcls virtual machine is showing in inventory as inaccessible on that datastore](https://www.virtualizationhowto.com/wp-content/uploads/2024/08/a-vcls-virtual-machine-is-showing-in-inventory-as-inaccessible-on-that-datastore.png)
I couldn’t remove the vCLS virtual machine from inventory in the vSphere Client. So I went over to the host client, and sure enough, I could unregister it here.
![Removing the vcls vm in the esxi host client](https://www.virtualizationhowto.com/wp-content/uploads/2024/08/removing-the-vcls-vm-in-the-esxi-host-client.png)
Now that the vCLS VM is unregistered from the host client side, the vSphere Client shows it as removed as well.
![The stuck vcls vm is now gone in the vsphere client](https://www.virtualizationhowto.com/wp-content/uploads/2024/08/the-stuck-vcls-vm-is-now-gone-in-the-vsphere-client.png)
Also, once I got rid of the stuck vCLS virtual machine, the datastore went away on its own.
![The inaccessible datastore disappears](https://www.virtualizationhowto.com/wp-content/uploads/2024/08/the-inaccessible-datastore-disappears.png)
Wrapping up
If you’ve encountered this issue in either a home lab or a production environment, start by checking for resources that might still be attached to the datastore. Common culprits include virtual machines (such as the vCLS machine shown above) and ISO images that are often overlooked when dealing with a stuck datastore. Typically, VMware vSphere handles resource cleanup automatically without requiring manual intervention. However, if no resources are attached to the datastore, you can use the vCenter Server MOB to forcibly remove it, as I had to in my case.
- Design
- Advertisement -