You can use vicfg-nas as a vCLI command with connection options.

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

Procedure

  1. List all known NAS file systems.
    vicfg-nas <conn_options> -l
    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 returns a No NAS datastore found message.
  2. Add a new NAS file system to the ESXi host.
    vicfg-nas <conn_options --add --nasserver dir42.eng.vmware.com -s /<mount_dir> 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 and the share name for the new NAS file system.
  3. Add a second NAS file system with read-only access.
    vicfg-nas <conn_options> -a -y --n esx42nas2 -s /home FileServerHome2
  4. Delete one of the NAS file systems.
    vicfg-nas <conn_options> -d FileServerHome1
    This command unmounts the NAS file system and removes it from the list of known file systems.