advertisment

advertisment

How to Remove an Inaccessible Datastore in VMware

3,250

- 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
Viewing an inaccessible datastore in vmware vsphere client

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
Select the content option in mob

Next, select the Datacenters option.

Selecting the root folder in the vcenter server mob interface
Selecting the root folder in the vcenter server mob interface

Next, select the childEntity which for me is CloudLocal my datacenter name.

Select the child entity in mob
Select the child entity in mob

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
Under datastores we see the datastore in question

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
Selecting the destroydatastore option

When you click it, you will see the below screen. Here we click Invoke Method.

Invoke the method for destroying the datastore
Invoke the method for destroying the datastore

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
Resource in use is reason the datastore won’t go away

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
A vcls virtual machine is showing in inventory as inaccessible on that datastore

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
Removing the vcls vm in the esxi host client

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
The stuck vcls vm is now gone in the vsphere client

Also, once I got rid of the stuck vCLS virtual machine, the datastore went away on its own.

The inaccessible datastore disappears
The inaccessible datastore disappears

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.

80%
Awesome
  • Design

- Advertisement -

- Advertisement -

- Advertisement -

Leave A Reply

Your email address will not be published.