How to remove inactive datastore from vSphere 6.0

datastorevmware-esxivmware-vcentervmware-vsphere

I followed this vmware guide to remove a storage device and replace with another. Everything worked fine apart from the fact the the datastore still show on the list as inactive.
During the procedure I'm supposed to:

  1. unmount the datastore
  2. detach storage device
  3. make sure it detached with esxcli storage core device detached list
  4. permanently remove device config with esxcli storage core device detached remove -d naa.xxxx

I had another one to remove and managed to figure out how to do it correctly by adding another step after 2

2.1 Click inactive datastore -> Actions -> Delete Datastore

Then continue

Does anybody know how to remove this inactive ghost datastore? I actually want to use the same name for the new datastore so can't really turn my blind eye on it.

Any help would be greatly appreciated.

Best Answer

I just had exactly the same problem. Check if you have VM snapshots.

# list snapshots
get-vm -datastore <dsname> |get-snapshot |select VM,name,created

If the VMs were connected to the datastore when the snapshot was made the VM will be connected to it until you remove the snapshot.

#remove all snapshots
get-vm -datastore <dsname> |get-snapshot |remove-snapshot