ESXi NFS Storage Add from CLI

After rebooting an ESXi guest, sometimes my NFS storage will no longer be visible to the system.  Upon trying to re-add the storage to the ESXi host, it will error.  To easily fix this issue, we will need to access the ESXi hosts CLI.

After accessing the CLI via SSH, we can issue the following command to see what datastores are mounted via NFS.

 ~ # esxcli storage nfs list
Volume Name                            Host                      Share                             Accessible  Mounted  Read-Only  Hardware Acceleration
-------------------------------------  ------------------------  --------------------------------  ----------  -------  ---------  ---------------------
applications.storage1.destephen.local  storage1.destephen.local  /media/data1/Applications               true     true      false  Not Supported        
c-pcd_NFS                              192.168.0.56              /common/adminsftp/fresh_install/        true     true       true  Not Supported        
~ #

With the storage listed, the storage device we are having an issue with is the applications.storage1.destephen.local.  First, we will want to remove the datastore.

~ # 
~ # esxcli storage nfs remove -v applications.storage1.destephen.local
~ #

Next, we will want to add the datastore back to the system.

~ # 
~ # esxcli storage nfs add 
Error: Missing required parameter -v|--volume-name
       Missing required parameter -H|--host
       Missing required parameter -s|--share

Usage: esxcli storage nfs add [cmd options]

Description: 
  add                   Add a new NAS volume to the ESX Host and mount it with the given volume name.

Cmd options:
  -H|--host=<str>       The hostname or IP address of the NAS volume to add and mount on the system.
                        (required)
  -r|--readonly         If set this flag will set the mount point to be read-only.
  -s|--share=<str>      The share name on the remote system to use for this NAS mount point. (required)
  -v|--volume-name=<str>
                        The volume name to use for the NAS mount.  This must be a unique volume name and
                        cannot conflict with existing NAS, VMFS or other volume names. (required)
~ # 
~ # esxcli storage nfs add -H storage1.destephen.local -v applications.storage1.destephen.local -s /media/data
1/Applications
~ #

With this process, we are now able to see the datastore within the ESXi client.

Leave a Reply

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