VMware Cloud Community
nocomplaintsofa
Contributor
Contributor
Jump to solution

Is there a CLI to create a NFS datastore

Is there a CLI to add a NFS datastore to the ESX ?  I am a newbie testing a storage product and am exhausted after repeatedly clicking through the VSphere Client screens to add a NFS datastore.   I looked at vmware-mount and vmware-diskmanager but that didn't seem to match my requirements.  I am using ESX 5.1

thanks

Tags (4)
0 Kudos
1 Solution

Accepted Solutions
ScreamingSilenc
Jump to solution

Yes you can add using powercli and as well as using Vi Client

New-Datastore -Nfs -VMHost 10.23.112.345 -Name Datastore -Path $remotePath -NfsHost $remoteHost

Creates a new Nfs datastore named Datastore on the virtual machine host with IP address 10.23.112.345 with the specified parameters.

Get-VMHost | New-Datastore -Nfs -Name NFS1 -Path "/mnt/nfs1/nfs11/test1" -NfsHost 10.91.246.21

Mount/Unmount an NFS Datastore using vSphere Client.

    • Mount an NFS Datastore
        1. Log in to vCenter or directly to the host using the VI Client
        2. Select a host from the left pane and then click the Configuration tab on the right
        3. Select Storage  in the left column of the center pane
        4. Click the Add Storage… hyperlink
        5. Select Network File System > click Next
        6. Enter in the server name or IP address in the Server field
        7. Enter in the folder path for the NFS share in the Folder field
        8. Check the Mount NFS read only checkbox if you want to mount the NFS volume as read only
        9. Enter in a name for the datastore in the Datastore Name field > click Next
        10. Click Finish
        11. The new NFS datastore should now appear in the Datastores view

I hope this would help you

Thanks

Please consider marking this answer "correct" or "helpful" if you found it useful.

View solution in original post

0 Kudos
5 Replies
ScreamingSilenc
Jump to solution

Yes you can add using powercli and as well as using Vi Client

New-Datastore -Nfs -VMHost 10.23.112.345 -Name Datastore -Path $remotePath -NfsHost $remoteHost

Creates a new Nfs datastore named Datastore on the virtual machine host with IP address 10.23.112.345 with the specified parameters.

Get-VMHost | New-Datastore -Nfs -Name NFS1 -Path "/mnt/nfs1/nfs11/test1" -NfsHost 10.91.246.21

Mount/Unmount an NFS Datastore using vSphere Client.

    • Mount an NFS Datastore
        1. Log in to vCenter or directly to the host using the VI Client
        2. Select a host from the left pane and then click the Configuration tab on the right
        3. Select Storage  in the left column of the center pane
        4. Click the Add Storage… hyperlink
        5. Select Network File System > click Next
        6. Enter in the server name or IP address in the Server field
        7. Enter in the folder path for the NFS share in the Folder field
        8. Check the Mount NFS read only checkbox if you want to mount the NFS volume as read only
        9. Enter in a name for the datastore in the Datastore Name field > click Next
        10. Click Finish
        11. The new NFS datastore should now appear in the Datastores view

I hope this would help you

Thanks

Please consider marking this answer "correct" or "helpful" if you found it useful.
0 Kudos
zXi_Gamer
Virtuoso
Virtuoso
Jump to solution

Hi and welcome to the communites..

If you have shell access, then it is quite easily done by esxcfg-nas command.

Example:

esxcfg-nas -a <SOMENAME> -o <NAS SERVER IP/hostname> -s /<share exported>

esxcfg-nas -a TEST -o 192.168.1.1 -s /testfolder

john23
Commander
Commander
Jump to solution

Managing ESX from command line, Its good to have vMA appliance. For managing nas :

vicfg-nas  <conn_options --add --nasserver dir42.eng.vmware.com -s /<mount_dir>nfsstore-dir42

vicfg-nas is the command.

http://pubs.vmware.com/vsphere-50/topic/com.vmware.ICbase/PDF/vsphere-esxi-vcenter-server-50-command...

-A

Thanks -A Read my blogs: www.openwriteup.com
nocomplaintsofa
Contributor
Contributor
Jump to solution

thanks everyone for the answers.  Looks like I can only mark 2 helpful answers so I picked one of the 3 to be the correct one.

I found all the tools you mentioned except for the VI (virtual infrastructure) client.  i can only find a link to 3.5 not 5.1.  Can someone provide a link to it ?

0 Kudos