NFS : Configure NFS Client2021/03/09 |
Configure NFS Client to mount NFS Share on NFS Client.
This example is based on the environment like follows. +----------------------+ | +----------------------+ | [ NFS Server ] |10.0.0.30 | 10.0.0.51| [ NFS Client ] | | dlp.srv.world +----------+----------+ node01.srv.world | | | | | +----------------------+ +----------------------+ |
[1] | Configure NFS Client. |
[root@node01 ~]#
dnf -y install nfs-utils
[root@node01 ~]#
vi /etc/idmapd.conf # line 5 : uncomment and change to your domain name Domain = srv.world
mount -t nfs dlp.srv.world:/home/nfsshare /mnt [root@node01 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs tmpfs 1.9G 8.6M 1.9G 1% /run
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mapper/cs-root xfs 26G 2.3G 24G 9% /
/dev/vda1 xfs 1014M 259M 756M 26% /boot
tmpfs tmpfs 374M 0 374M 0% /run/user/0
dlp.srv.world:/home/nfsshare nfs4 26G 2.3G 24G 9% /mnt
# NFS share is mounted
# if mount with NFSv3, add [-o vers=3] option [root@node01 ~]# mount -t nfs -o vers=3 dlp.srv.world:/home/nfsshare /mnt [root@node01 ~]# df -hT /mnt Filesystem Type Size Used Avail Use% Mounted on dlp.srv.world:/home/nfsshare nfs 26G 2.3G 24G 9% /mnt |
[2] | To mount automatically when System starts, Configure setting in [/etc/fstab]. |
[root@node01 ~]#
vi /etc/fstab /dev/mapper/cs-root / xfs defaults 0 0 UUID=72e65d16-7d1a-40bc-9bc1-e45a8ba6d084 /boot xfs defaults 0 0 /dev/mapper/cs-swap none swap defaults 0 0 # add to the end : set NFS share dlp.srv.world:/home/nfsshare /mnt nfs defaults 0 0 |
[3] | To mount dynamically when anyone access to NFS Share, Configure AutoFS. |
[root@node01 ~]#
dnf -y install autofs
[root@node01 ~]#
vi /etc/auto.master # add to the end /- /etc/auto.mount
[root@node01 ~]#
vi /etc/auto.mount # create new : [mount point] [option] [location] /mnt -fstype=nfs,rw dlp.srv.world:/home/nfsshare
[root@node01 ~]#
systemctl enable --now autofs # move to the mount point to verify mounting [root@node01 ~]# cd /mnt [root@node01 mnt]# total 8 -rw-r--r--. 1 root root 10 Mar 3 19:14 testfile.txt -rw-r--r--. 1 root root 5 Mar 3 19:17 test.txt[root@node01 mnt]# grep /mnt /proc/mounts /etc/auto.mount /mnt autofs rw,relatime,fd=17,pgrp=2468,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=33352 0 0 dlp.srv.world:/home/nfsshare /mnt nfs4 rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.0.0.51,local_lock=none,addr=10.0.0.30 0 0 |
Sponsored Link |