Unable to remove an inactive datastore in ESXi 5.0

If you have found one of your datastores is greyed out/inactive one solution is to unmount it and add it again; sometimes ESXi won’t let you do this, giving the following error message: “Error: The resources ‘ip.of.data.store:/data/location’ is in use. Error stack: Call “HostDatastoreSystem.RemoveDatastore” for object “ha-datastoresystem” on ESXi “ip.of.your.esxi” failed.  
The fix is quite easy – enable SSH access on your server (if you’re not sure how, see our guide here) and log into the root account. Run the following command: # esxcli storage nfs list   That will list all of the datastores currently available to ESXi via NFS. Now to unmount the inaccessible datastore we run: # esxcli storage nfs remove -v [inaccessible datastore name, here codexSSD] This will return us to the prompt like so:     If you list the available datastores again it should be gone:   # esxcli storage nfs list     Log out and check your vSphere Client’s storage tab – it should be gone there, too. If it hasn’t disappeared refresh the view. From here you should be able to add the datastore again without hassle.