NFS : Configure NFS Client2024/11/01 |
Configure NFS Client to mount NFS Share on Client computer.
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
/dev/mapper/fedora-root xfs 15G 2.0G 14G 13% /
devtmpfs devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs tmpfs 782M 1.1M 781M 1% /run
tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-journald.service
tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-network-generator.service
tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-udev-load-credentials.service
tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-sysctl.service
tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-tmpfiles-setup-dev-early.service
tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-tmpfiles-setup-dev.service
tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-vconsole-setup.service
tmpfs tmpfs 2.0G 0 2.0G 0% /tmp
/dev/vda2 xfs 960M 316M 645M 33% /boot
tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-tmpfiles-setup.service
tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-resolved.service
tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/getty@tty1.service
tmpfs tmpfs 1.0M 0 1.0M 0% /run/credentials/serial-getty@ttyS0.service
tmpfs tmpfs 391M 4.0K 391M 1% /run/user/0
dlp.srv.world:/home/nfsshare nfs4 15G 2.0G 14G 13% /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 15G 2.0G 14G 13% /mnt |
[2] | To mount NFS share automatically when System starts, add setting in [/etc/fstab]. |
[root@node01 ~]#
vi /etc/fstab UUID=7a46325a-1310-4bbf-85cd-77b328a33e77 / xfs defaults 0 0 UUID=52bc9271-2c18-4cf3-9885-503c0f22b4ae /boot xfs defaults 0 0 # add to last line : set NFS share dlp.srv.world:/home/nfsshare /mnt nfs defaults 0 0 |
[3] | To mount NFS share dynamically when anyone access to there, Configure AutoFS. |
[root@node01 ~]#
dnf -y install autofs
[root@node01 ~]#
vi /etc/auto.master # add to last line /- /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]# df -hT /mnt Filesystem Type Size Used Avail Use% Mounted on dlp.srv.world:/home/nfsshare nfs4 15G 2.0G 14G 13% /mnt[root@node01 mnt]# grep /mnt /proc/mounts /etc/auto.mount /mnt autofs rw,relatime,fd=12,pgrp=1433,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=13371 0 0 dlp.srv.world:/home/nfsshare /mnt nfs4 rw,relatime,vers=4.2,rsize=524288,wsize=524288,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 |
|