How To Fix An Unavailable vSphere NAS Mount using SSH

In the lab, I have an isolated NFS datastore for ISO files to ensure that it is obvious whenever I have an ISO loaded to a VM. Nothing is easier to spot than seeing a VM being attached to the “ISO” datastore, which helps enforce cleanup and remind me what state the lab is in as often my work in there is interrupted. All of the hosts have access to this datastore to make it easy to mount a single repository of images to any VM.

I decided to do some work on a VM in my management cluster that required the use of an ISO and discovered that the datastore was missing. My first step in troubleshooting was to check to see if it showed up in the GUI – which it did not.

I only saw my two primary NFS datastores used for hosting virtual machines.


The next step was to simply try mounting the NFS volume to see if an error popped up. Sure enough, one did. What I found interesting was that the error was basically telling me that the name already existed on the host, leading me to believe that it was an issue with having an unavailable NFS volume.


However, the other hosts in the cluster could see the NAS just fine. It was time to dig a bit deeper.


I dusted off some old knowledge in the magical land of ESXCFG and popped open an SSH session to the host. I first ran the lookup command:

esxcfg-nas -l

Apparently the hypervisor felt that NAS1 was not available and had unmounted the volume. I had been doing some changes in the network as I consolidated some iSCSI targets over to NFS exports, so I felt this was the culprit. To remedy the issue, I deleted and added the volume back via CLI because the GUI would only error out. The syntax is rather straight forward.

To delete the volume, just use a “-d” argument with the volume name.

esxcfg-nas -d NAS1-ISO

Then to add the volume back onto the host pass the “-a” argument with an “-o” for the host and “-s” for the path and follow it up with the name of the datastore.

Note: Make sure to match the name to the rest of the cluster.

esxcfg-nas -a -o nas1.glacier.local -s /volume1/ISO NAS1-ISO

And here’s what it looks like in PuTTY


Seeing VMs Using ISO Files

I alluded to the concept of easily identifying VMs with ISO files mounted to them. Here is a visual of exactly what I mean by that. If I click on the “Datastores and Datastore Clusters” view and select the NAS1-ISO datastore, I can then click on the “Virtual Machines” tab to see any VM that is tethered to an ISO file.


While there are plenty of other ways to accomplish this, such as RVTools or a PowerCLI script, this works for me. 🙂

[symple_box color=”black” fade_in=”false” float=”center” text_align=”left” width=””]You can find all of my various PowerShell scripts in my GitHub repository[/symple_box]


Just goes to show that sometimes the old tricks still serve you well. 🙂