VMware ESXi – How to Remove an NFS Share that’s ‘In Use’

I recently moved house, and as part of that a few things on my network changed. My NAS (A Synolofy DS8J) changed it’s IP Address. This caused an issue when ESXi was trying to get hold of the datastore.

So, now this needs to be removed and replaced – I came across this error:

Remove Datastore 
Description 
State 
Errors 
haTask-ha-host-vim.hostDatastoreSystem.removeDatastore-3885 
Removes a datastore frorn a host 
Failed - The resource •NAS' is in use. 
Cannot remove datastore 'NAS' because One or more virtual machines are stil registered on it.

After a bit of frantic Googling, I came across: https://kb.vmware.com/s/article/2008507

Accessing the CLI was needed to resolve this, so jump into the ESXi CLI and run:

esxcli storage nfs list
Vol urne 
NAS 
Name 
Host 
192 . 168.1. 180 
Share 
/vol umel/esx 
Accessible 
false 
Mounted 
false 
Read-Only 
fal se 
i SPE 
false 
Hardnare Acceleration 
Unknown

Now you have the name, in this case “NAS”, we can call the following to remove it.

esxcli storage nfs remove -v=NAS

Sorted!

Leave a Reply

Your email address will not be published. Required fields are marked *