Here are the 5 easy steps to mount NFS shared directory on another Linux Server. Please go through the steps.

Please go through the steps below:

  • Install the below Network File System Packages in both the NFS server(server1) & NFS Client(server2).

[root@server1]# rpm -qa|grep -i nfs

  • Make a directory in NFS server which you want to share with NFS Clent & make a directory in NFS client for a Mount Point. For sharing, you need to put its entry in /etc/exports in the NFS Server.

[root@server1]# mkdir /share
[root@server1]# cat /etc/exports
/share *(sync)

* –>To be shared with all the servers.

[root@server2]# mkdir /mount

  • Restart RPC bind service in both the server

[root@server1]# serive rpcbind restart
[root@server2]# serive rpcbind restart

  • Restart NFS service in both the server

[root@server1]# service nfs restart
[root@server2]# service nfs restart

  • Run the below command in NFS client which will mount the /Share directory in NFS server on the mount point /mount in the NFS Client.

[root@server2]# mount <server1 IP>:/share /mount

You are done now –> /share present in server machine is mounted on the mount point /mount present on the Client machine.The same can be verified from the below command

[root@server2]# df -ah
Filesystem Size Used Avail Use% Mounted on
<server1 IP>:/share 16G 14G 1.8G 89% /mount

Trouble Shooting Tips:

  • The below error comes when the /share directory in NFS server is not given access to the NFS client.So you need to define it /etc/exports

[root@server2]# mount <server1 IP>:/share /mount
mount.nfs: access denied by server while mounting

  • The below error comes when there is a firewall rule set on the other server for the particular port. To resolve the issue you can flush the firewall rules.

[root@server2]# rpcinfo -p
rpcinfo: can’t contact portmapper: RPC: Remote system error – No route to host

a) Flushing Firewall
[root@server1]# service iptables stop –>May be the firewall is there which is restricting access..
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: nat filter [ OK ]
iptables: Unloading modules: [ OK ]

b) Post flushing, run the below command and you can check the other server NFS status.
[root@server2]# rpcinfo -p
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper

It will be very helpful if you guys can give your feedback here.

Leave a Reply

Be the First to Comment!

Notify of