How To create and attach a NFS share to a Linux Server

This article provides step-by-step instructions on how to get create, expose and use a VPSA NAS share.

1. Create NAS Volume

Go to the VPSA GUI 'Volumes' and click Create. The Create Volume dialog will appear. Set up the following NAS properties:

  • Name: Customize the name of the NFS share
  • Capacity: The capacity of the share in GB
  • Volume Type: Select 'Filesystem Share'
  • Mode:  Simple or Stripe. *For stripe you must select at least two raid groups.
  • Export Name:  The name of the NFS mount point. If not specified, VPSA will assign the Volume Name as the Export Name.
  • Mount Sync: By default it is checked, indicating that writes are synchronous.  Note: Disabling mount sync option speeds up data access but may result in data loss if a transfer is interrupted
  • Choose one or more Raid groups and click create.

  • A confirmation dialog will appear. Review the NAS share properties and confirm by clicking OK.

 

Your NFS share will be created.


 

2. Attach the NAS Volume as an NFS Share to a Server

Go to the VPSA Servers page and click Attach. The Attach Server dialog will appear. Set up the following NAS properties:

  • Choose one or more servers from the list.

  • Click Attach. A confirmation dialog will appear. Review the properties and confirm by clicking OK

.

  • You server now has permission to the NFS share.

 

3 Connect the NFS share to a Linux Client:

3.1. Add NFS support to your Linux Client:

  •  In Ubuntu: do 'apt-get install nfs-common'; 
  • In Redhat/CenOS: do 'yum install nfs-utils'

3.2. Create a mount point in a Linux client

  • mkdir /mnt/nfs_share
  • Run the following command as the superuser (or with sudo) from the client

mount –t nfs4 <VPSA IP>:/<Export Name> /<mount point>

  • VPSA IP: VPSA floating IP for iSCSI and NAS connectivity. Go to Controllers and copy the iSCSI IP.
  • Export Name: The name of the NFS mount point. Go to Volumes and copy the Export name.

e.g. mount –t nfs4 170.70.2.103:/export/nfs_share /mnt/nfs_share

 To automatically mount shares on system startup, you can use an fstab entry similar to the following:

172.70.2.103:/export/nfs_share /mnt/nfs_share nfs4 _netdev 0 0

For systemd based distros like RHEL 7, CentOS 7, Arch, etc. you can use systemd to mount your NFS share.  Please see the attached "mnt-nfs.mount" file as a reference.  Once installed to the system, run "systemctl enable mnt-nfs.mount" and "systemctl start mnt-nfs.mount" to mount the share.  If you use this style of mounting, there is no need to make entries in /etc/fstab.

4 Basic Authentication Settings

4.1 For Linux Client:

By default "root" user and group at NFS client are mapped to "root" user and group in the VPSA NFS server. All other users are mapped to user "nobody" and group "nogroup".

In order to set a basic NFS authentication so that users and groups at the client will be mapped to the corresponding users and groups at the VPSA NFS server perform the following steps:

  • Go to VPSA GUI > Controllers and click NFS Domain. The NFS Domain dialog will appear.



  • Enter NFS domain name identical to the domain name set in the Client and click  Update.

NOTE1: In a Linux client, the domain name is usually set in /etc/idmap.conf file. It is mandatory to have this value set.

NOTE2: It is safer to use 'localdomain' as the value, as this also appears in /etc/hosts .  Other defaults such as 'local.domain.edu' may not already be in /etc/hosts.

NOTE3: Make sure that all users and groups exist before starting idmapd.  In Redhat and derivatives, including CentOS and Amazon Linux, adding users or groups to the VPSA or the host system after idmapd has been started for the first time will not update the cache that idmapd uses, which is separate from idmapd.

 

NOTE4: Make sure idmapd service is running (In Ubuntu idmapd service. In RedHat 6 rpcidmapd. In RedHat 7 run "systemctl start rpcbind nfs-lock nfs-idmap nfs-mountd")

 

After setting this, remount the volume.

  • Go to Access Control > NFS Users and click Create. The Create NFS User dialog will appear.

Set the following properties:

  • Username: Enter the same username as it appears in the client

  • NFS UID: Enter the same user id as it appears in the client. User ID can be retrieve in the Linux Client by the following command: 'id <username>'

  • Click Create User

.

  • Finally, go to Access Control > NFS Groups and click Create. The Create NFS Group dialog will appear.

Set the following properties:

  • Group Name: Enter the same group name as it appears in the client
  • NFS GID: Enter the same group id as it appears in the client. Group ID can be retrieve in the Linux Client by the following command: 'id <username>'
  • Click Create Group

.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.