Professional Documents
Culture Documents
NFS Configuration on Linux RHEL
NFS Configuration on Linux RHEL
NFS (Network File System) is used to sharing the files and folders between linux to unix and
unix to linux machines,NFS was developed by Sun Mycro Systems in the year 1984.
Features:
1. Every one can access same data.
Packages : i) nfs-utils
ii) nfs-utils-lib
status files
/etc/exports
/var/lib/nfs/rmtab
/var/lib/nfs/xtab
/etc/hosts.allow
/etc/hosts.deny
Daemons
rpc.portmap
rpc.mountd
rpc.nfsd
rpc.statd
rpc.lockd
rpc.rquotad
/etc/rc.d/init.d/nfs
nfstat
showmount
rpcinfo
exportfs
To setup NFS Server, we have at least two Linux Machines. one is NFS Server and another one
is NFS Client
Sever Side
(or)
To export directory.
#vim /etc/exports
/oracle *(rw,sync ,no_root_squash ,no_all_squash)
/oracle 192.168.0.0/24(ro,sync)
:wq
Note
# exportfs -v
/oracle <world>(rw,wdelay,no_root_squash,no_subtree_check)
# ,
#chkconfig nfs on
# showmount -e 192.168.0.17
# exportfs -u
/oracle 192.168.0.75
/var/ftp/pub <world>
/kick <world>
#
(I)
# yum install nfs-utils nfs-utils-lib -y
(II)
# yum install showmount rpcbind -y
# chkconfig nfs on
Step2 : To findout which files or directories are exported from the server
# showmount -e 192.168.6.136
Export list for 192.168.6.136:
/oracle *
#
#mount
# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2 ext4 18G 2.4G 15G 15% /
tmpfs tmpfs 495M 224K 495M 1% /dev/shm
/dev/sda1 ext4 291M 33M 243M 12% /boot
/dev/sr0 iso9660 3.5G 3.5G 0 100% /mnt
192.168.6.136:/oracle
nfs 18G 2.4G 15G 15% /data
#
# cd /data
# ls
abc.txt
# cat abc.txt
this is test file for NFS
#
For permanent
:wq
#mount -a
#cd /data
#ls
If the NFS file system is hard mounted, the NFS daemons will try repeatedly to contact the
server. The NFS daemon retries will not time out, will affect system performance, and you
cannot interrupt them
If you just mount a file system without specifying hard or soft, the default is a hard mount.
Hard mounts are preferable because of the stateless nature of NFS.
If a client sends an I/O request to the server (such as an ls -la), and the server gets
rebooted, in client machine the process will keep on running.
This preserves data transfers in the event of a server failure
ex:
Hard Mount (Permanent mounting):-
[root@sadeek~]# mount -o rw,hard,intr 172.28.50.109/nfs /mnt
[root@sadeek ~]# vim /etc/fstab
172.28.50.109:/nfs /mnt nfs Defaults 0 0
:wq!
We can check nfs share with the help of below mention command.
[root@sushee ~]# mount –a
A soft mount allows the client to stop trying an operation after a period of time. If the NFS
server goes down at the time of data transfer , it will alert and the process will do
down.Thsi may cause the data corruption.
A soft link will return with an error and fail.
you should only use soft mounts in the cases where client responsiveness is more important
than data integrity.
In another word ..soft mount will allow automatic unmount if the filesystem is idle for a
specified time period
[root@localhost ~]# service rpcbind restart =====> To restart the rpcbind once
Stopping rpcbind: [FAILED]
Starting rpcbind: [ OK ]
scniario2
Client side
solution
server side :
2. #iptables -L
3.#iptables -F
or
#chkconfig nfs on
# mount -v