Two shared NFS shares in RHEL6, one is not getting mounted as NFSv4.

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 6

Issue

  • Two NFS shares are shared in RHEL6 as
/home/test123/apps/resources *(rw,insecure,no_root_squash,no_subtree_check,async)
/data *(rw,insecure,no_root_squash,no_subtree_check,async)

First share on the client side gives error while mounting

# mount 10.0.11.148:/home/test123/apps/resources /home/test123/apps/resources
mount.nfs: access denied by server while mounting 10.0.11.148:/home/test123/apps/resources  <---- 

Second share can be mounted correctly

# cat /proc/mounts |grep nfs
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
nfsd /proc/fs/nfsd nfsd rw,relatime 0 0
10.0.11.148:/data/ /datafiles nfs4 rw,relatime,vers=4,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.0.11.149,minorversion=0,local_lock=none,addr=10.0.11.148 0 0

First share can be mounted as nfsv3 successfully

#mount -t nfs -o nfsvers=3 10.0.11.148:/home/test123/apps/resources     /home/test123/apps/resources

Resolution

[1] Change the /etc/exports entries as given below

      /home 10.0.11.149(rw,async,wdelay,insecure,no_root_squash,no_subtree_check,fsid=1)      
      /data 10.0.11.149(rw,async,wdelay,insecure,no_root_squash,no_subtree_check,fsid=2)

[2] Re-export all directories using below command.

      # exportfs -r
      # exportfs -v         <== Ensure that all option are reflecting. 

[3] Unmount the shares in client and mount it again.

      # umount /home/test123/apps/resources; umount /data
      # mount 10.0.11.148:/home/test123/apps/resources /home/test123/apps/resources
      # mount 10.0.11.148:/data /data

[4] Check the mounted filesystem details.

      # grep 10.0.11.148 /proc/mounts 

It should show similar to as seen below

10.0.11.148:/home/test123/apps/resources /home/test123/apps/resources nfs4 rw,relatime,vers=4,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.0.11.149,minorversion=0,local_lock=none,addr=10.0.11.148 0 0
10.0.11.148:/data/ /data nfs4 rw,relatime,vers=4,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.0.11.149,minorversion=0,local_lock=none,addr=10.0.11.148 0 0

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments