Configure NFS Client (CentOS)2015/01/10 |
Configure NFS Client. This example is based on the environment below.
+----------------------+ | +----------------------+ | [ NFS Server ] |10.0.0.30 | 10.0.0.31| [ NFS Client ] | | dlp.srv.world +----------+----------+ www.srv.world | | | | | +----------------------+ +----------------------+ |
|
[1] | Configure NFS Client. |
[root@www ~]#
yum -y install nfs-utils
[root@www ~]#
vi /etc/idmapd.conf # line 5: uncomment and change to your domain name Domain = srv.world /etc/rc.d/init.d/rpcbind start Starting rpcbind: [ OK ][root@www ~]# /etc/rc.d/init.d/netfs start Mounting filesystems: [ OK ][root@www ~]# mount -t nfs dlp.srv.world:/home /home [root@www ~]# df -hT Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root ext4 16G 1.3G 14G 9% / tmpfs tmpfs 939M 0 939M 0% /dev/shm /dev/vda1 ext4 477M 117M 335M 26% /boot dlp.srv.world:/home nfs 16G 1.3G 14G 9% /home # /home from NFS server is mounted
|
[2] | Configure NFS mounting on fstab to mount it when the system boots. |
[root@www ~]#
vi /etc/fstab /dev/mapper/VolGroup-lv_root / ext4 defaults 1 1 UUID=3d3f19a1-582f-4a29-a304-349750094b2c /boot ext4 defaults 1 2 /dev/mapper/VolGroup-lv_swap swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 # add like follows dlp.srv.world:/home /home nfs defaults 0 0 |
[3] | Configure auto-mounting. For example, set NFS directory on /mntdir. |
[root@www ~]#
yum -y install autofs
[root@www ~]#
vi /etc/auto.master # add follows to the end /- /etc/auto.mount
[root@www ~]#
vi /etc/auto.mount # create new : [mount point] [option] [location] /mntdir -fstype=nfs,rw dlp.srv.world:/home
[root@www ~]#
mkdir /mntdir [root@www ~]# /etc/rc.d/init.d/autofs start [root@www ~]# chkconfig autofs on # move to the mount point to make sure it normally mounted [root@www ~]# cd /mntdir [root@www mntdir]# total 4 drwx------ 2 cent cent 4096 Apr 12 2012 cent[root@www mntdir]# cat /proc/mounts | grep mntdir /etc/auto.mount /mntdir autofs rw,relatime,fd=19,pgrp=1183,timeout=300,minproto=5,maxproto=5,direct 0 0 dlp.srv.world:/home/ /mntdir nfs4 rw,relatime,vers=4,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp, port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.0.0.31,minorversion=0,local_lock=none,addr=10.0.0.30 0 0 |
Sponsored Link |
|