VMware

How to Remove an Inaccessible Datastore in VMware

Learn how to remove an inaccessible VMware datastore in your home lab or production environment. Follow this step-by-step guide.

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 one that is pretty intuitive in what it is. You can see in the image below, that an inaccessible datastore is one that is noted that way in the storage tab in the vSphere client. It will show up in italics compared to the others, and it will have the (inaccessible) designation next to it.

You would think you can just right-click the datastore and select “remove from inventory” or something similar. However, this option is greyed out. Let’s see if 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.

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?

So, now we are getting to the bottom of why the datastore won’t go away since it is inaccessible. We have a resource that is latched on to the datastore. Actually, when I had the datastore in inventory and everything was healthy, there was a vCLS VM that was using the datastore. When the datastore went inaccessible (I removed the NVMe drive), this vCLS VM was stuck in 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 have ran into this issue either in the home lab or production, you need to first look at the resources that may still be stuck to the datastore. There are common culprits that will cause this issue, including virtual machines (like shown above with the vCLS machine), also ISO images are things that get forgotten about with a stuck datastore. Usually, VMware vSphere does a good job of getting rid of things on its own without manual intervention. However, you can use the MOB for vCenter Server to forcibly remove the datastore, if you don’t have resources that are latching on to it as I had.

Subscribe to VirtualizationHowto via Email ๐Ÿ””

Enter your email address to subscribe to this blog and receive notifications of new posts by email.



Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com, and a 7-time VMware vExpert, with over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family. Also, he goes through the effort of testing and troubleshooting issues, so you don't have to.

Related Articles

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.