VMware vSphere

 View Only

 Cannot remove empty datastore - vCenter 6.5

Jump to  Best Answer
Konnan's profile image
Konnan posted Feb 12, 2025 01:59 PM

Hello everyone!

We had a storage outage and since then we have an issue with two datastores in vCenter 6.5. When everything came back from the outage, duplicate datastores were created for two datastores. The "new ones" have the file hierarchy in them and they are associated to all the right VMs. The "old ones" have no file hierarchy in them and are associated with no VMs and are running on no hosts.

I tried using the vCenter GUI to remove them but it won't let me. It says I have to choose an host first to remove a datastore, problem is, it's not associated to any host or any VM. Is there another way to do it properly? Tried to find articles about doing it another way, maybe in CLI but didn't find anything.

If I go in either of the two ESXi 6.5 hosts, there's only the two "new" datastores, the empty old ones are nowhere to be seen, they only exist in vCenter GUI.

Any idea?

Thanks!

Konnan

Konnan's profile image
Konnan  Best Answer

Hello again!

Finally, looks like I fixed this... by deleting all snapshots and consolidating disks! Maybe there was something in the snapshots that were preventing me to remove the datastores but only in vCenter.

Thanks!

Konnan

Andrea Consalvi's profile image
Andrea Consalvi

Hi Konnan,

From what you described, it looks like the old datastores are still orphaned in vCenter but no longer actually exist on the ESXi hosts. This happens when vCenter retains references to storage that no longer exists in the real system. To resolve this safely and avoid issues, you can remove them directly from vCenter using PowerCLI.

First, connect to vCenter via PowerCLI using the command:

Connect-VIServer -Server <vcenter_address> -User <username> -Password <password> 

Once connected, list all the existing datastores with:

Get-Datastore | Select Name, Id 

If the old datastores are still listed, proceed with removing them using:

Remove-Datastore -Datastore <Datastore-Name> -Confirm:$false 

This will delete the orphaned datastore reference directly from vCenter without needing any interaction with the ESXi hosts.

If PowerCLI does not resolve the issue and the datastores are still visible in the vCenter GUI, it means that vCenter might still have residual references in its database. In this case, restarting the vpxd service can help clear them. You can do this by running:

service-control --restart vmware-vpxd

on the vCenter server. After the restart, check again if the orphaned datastores are still present, and try removing them again if necessary.

With this method, you avoid performing any risky operations on the hosts and act safely within vCenter itself. This should resolve the issue without leaving any residual traces. Let me know if it work

Konnan's profile image
Konnan

Hello!

Thanks for that thorough answer @Andrea Consalvi !

Unfortunately, it didn't work. When I try in PowerCLI I get this :

PS C:\Program Files\PowerShell> Remove-Datastore -Datastore store01 -Confirm:$false
Remove-Datastore: 2025-02-13 12:04:25   Remove-Datastore                Value cannot be found for the mandatory parameter VMHost

I double checked in both ESXi and that datastore is not there anymore.

I went a bit further in vCenter and I saw that the "old" datastore was still attached to a couple of VMs on disconnected DVD drives. After removing that, I saw that when I go in the "VM" tab of the "old" datastore, a couple VMs disappeared from there. Unfortunately, there's still VMs left there, and I don't know why they show there. In ESXi there's nothing about that. I checked the configuration again and I find no links to the old datastore anymore.

I tried restarting vmware-vpxd as you suggested, didn't work either.

Any other idea?

Thanks!

Konnan

Andrea Consalvi's profile image
Andrea Consalvi

Great news! I'm glad you solved it. Honestly, I thought the snapshot check had already been done. The important thing is that it's resolved.

Konnan's profile image
Konnan

@Andrea Consalvi yeah my bad, didn't expect that because of an old snapshot, it would hang on the datastore, but it makes sense, in some way, but not in other ways, because if the datastore doesn't exist anymore, it would be very hard to revert to snapshot... Same thing with disconnected DVD drive, why hang on a datastore if the drive is disconnected, oh well...

Thanks for your help! I think your "residual references in the database" put my mind on the right path.

Konnan