As a pre-requisite you need to have root access in all your servers you are trying to connect.
1. edit /etc/exports file to have the following entries:
where /usr/data in the local machine is the directory you want to share with machines with ip nnn.n.n.n and mmm.m.m.m. Here rw means read write, sync is to synchronise.
You can change this file in all the servers you want to share items with.
2. make entries in your /etc/hosts file which should read something like:
127.0.0.1 xxx.localdomain localhost
nnn.n.n.n yyy.localdomain -> where your machine has the name 'xxx' and the ip address of the machine you are trying to have in network is nnn.n.n.n and the name of that machine is: 'yyy'. This way you can keep adding the number of machines in the network that you wish to add.
3. In newer machines you can make the following entries into your /etc/hosts.deny file:
All these commands are harmless, and nothing happens if your system does not have a particular protocol. But it is a great way to protect your machine.
4. In /etc/hosts.allow file add the following lines:
service:nnn.n.n.n , mmm.m.m.m
lockd:nnn.n.n.n , mmm.m.m.m
rquotad:nnn.n.n.n , mmm.m.m.m
mountd:nnn.n.n.n , mmm.m.m.m
statd:nnn.n.n.n , mmm.m.m.m
5. Run rpcinfo -p to check if portmapper, rquotad, mountd, nfs, amd, status, nlockmgr is running.
(where nnn.n.n.n and mmm.m.m.m are the other two machines in your network you wish to give nfs access to)
6. Run exportfs -ra to make nfsd to read /etc/exports
7. Check /proc/filesystems and see if there is an entry on nfs. If it is there then you are good to go
8. Check if rpc.statd and rpc.lockd is running by doing ps aux | grep statd or ps aux | grep lockd
9. Also check if nfs is running on your machine. For that do a
service nfs restart, then you should get the following:
[root@MYX]# service nfs stop
Shutting down NFS mountd: [ OK ]
Shutting down NFS daemon: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
[root@MYX]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
9. Finally mount the file system. Make sure you have mount package is installed in your computer.
be a root in machine xxx.x.x.x and you want to have /usr/data drive of machine nnn.n.n.n to be mounted in /share/data in your local file system -> do the following:
mount -t nfs nnn.n.n.n:/usr/data /share/data
and keep adding mount drives for other machines as well. In other words, nnn.n.n.n:/filesystem is the remote i and the absolute location of the remote ip and /share/data is the drive it needs to be mounted.
Do the same for other machines if you want to have drives from your machine xxx.x.x.x to be mounted else where. Now finally you are done!!
For all redhat linux machines, the following can be done:
make entries in /etc/fstab file of your local machine with the following syntax:
mount-t nfs AAA.localdomain:/usr/apaladata /share/apaladata
mount-t nfs BBB.localdomain:/usr/amritdata /share/amritdata
Where as your machine is CCC .
Another redhat article is here: https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/nfs-clientconfig.html
Happy creating network file system....