You can list, add, and delete a NAS file system with ESXCLI.

For more information on connection options, see Connection Options for ESXCLI Host Management Commands.

Procedure

  1. List all known NAS file systems.
    esxcli <conn_options> storage nfs list
    For each NAS file system, the command lists the mount name, share name, and host name and whether the file system is mounted. If no NAS file systems are available, the system does not return a NAS filesystem and returns to the command prompt.
  2. Add a new NAS file system to the ESXi host.
    Specify the NAS server with --host, the volume to use for the mount with --volume-name, and the share name on the remote system to use for this NAS mount point with --share.
    esxcli <conn_options> storage nfs add --host=dir42.eng.vmware.com --share=/<mount_dir> --volume-name=nfsstore-dir42
    This command adds an entry to the known NAS file system list and supplies the share name of the new NAS file system. You must supply the host name, share name, and volume name for the new NAS file system.
  3. Add a second NAS file system with read-only access.
    esxcli <conn_options> storage nfs add --host=dir42.eng.vmware.com --share=/home --volume-name=FileServerHome2 --readonly
  4. Delete one of the NAS file systems.
    esxcli <conn_options> storage nfs remove --volume-name=FileServerHome2
    This command unmounts the NAS file system and removes it from the list of known file systems.