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.
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.
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.
Next, select the Datacenters option.
Next, select the childEntity which for me is CloudLocal my datacenter name.
Under datastore you will see the datastore in question listed. Click the link next to the datastore.
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.
When you click it, you will see the below screen. Here we click Invoke Method.
Ah, now we are seeing the reason why the datastore won’t go away. We are getting a ResourceInUse error.
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.
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.
Now that the vCLS VM is unregistered from the host client side, the vSphere Client shows it as removed as well.
Also, once I got rid of the stuck vCLS virtual machine, the datastore went away on its own.
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