0845680984
  1. Configure NFS Server
  2. Configure NFS Client
  3. NFS 4 ACL Tool

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    ] |
|     nfs.srv.local    +----------+----------+    client.srv.local  |
|                      |                     |                      |
+----------------------+                     +----------------------+
[1] Configure NFS Client.
root@client:~# apt -y install nfs-common
root@client:~# vi /etc/idmapd.conf
# line 6: uncomment and change to your domain name
Domain = srv.local
root@client:~# mount -t nfs nfs.srv.local:/home/nfsshare /mnt
root@node01:~# df -hT
Filesystem                        Type      Size  Used Avail Use% Mounted on
udev                              devtmpfs  1.9G     0  1.9G   0% /dev
tmpfs                             tmpfs     394M  1.1M  393M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv ext4       25G  2.2G   22G  10% /
tmpfs                             tmpfs     2.0G     0  2.0G   0% /dev/shm
tmpfs                             tmpfs     5.0M     0  5.0M   0% /run/lock
tmpfs                             tmpfs     2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda2                         ext4      976M  103M  806M  12% /boot
/dev/loop0                        squashfs   55M   55M     0 100% /snap/core18/1705
/dev/loop2                        squashfs   69M   69M     0 100% /snap/lxd/14804
/dev/loop1                        squashfs   55M   55M     0 100% /snap/core18/1754
/dev/loop3                        squashfs   28M   28M     0 100% /snap/snapd/7264
/dev/loop4                        squashfs   70M   70M     0 100% /snap/lxd/14890
tmpfs                             tmpfs     394M     0  394M   0% /run/user/0
nfs.srv.local:/home/nfsshare      nfs4       25G  2.2G   22G  10% /mnt
# NFS share is mounted

# if mount with NFSv3, add [-o vers=3] option
root@client:~# mount -t nfs -o vers=3 nfs.srv.local:/home/nfsshare /mnt
[2] To mount automatically when System starts, Configure setting in [/etc/fstab].
root@client:~# vi /etc/fstab
# add to the end : set NFS share
nfs.srv.local:/home/nfsshare /mnt               nfs     defaults        0 0
[3] To mount dynamically when anyone access to NFS Share, Configure AutoFS
root@client:~# apt -y install autofs
root@client:~# vi /etc/auto.master
# add to the end
/-    /etc/auto.mount

root@client:~# vi /etc/auto.mount
# create new : [mount point] [option] [location]
/mnt   -fstype=nfs,rw  nfs.srv.local:/home/nfsshare

root@client:~# systemctl restart autofs
# move to the mount point to verify mounting
root@client:~# cd /mnt
root@client:/mnt# ll
total 12
drwxr-xr-x  3 root   root   4096 Apr 22 00:47 ./
drwxr-xr-x 19 root   root   4096 Apr 25 10:05 ../
-rw-r--r--. 1 root   root      5 May  4 19:14 testfile.txt
-rw-r--r--. 1 root   root      5 May  4 19:12 test.txt

root@client:/mntdir# cat /proc/mounts | grep mnt
nsfs /run/snapd/ns/lxd.mnt nsfs rw 0 0
nfs.srv.local:/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
/etc/auto.mount /mnt autofs rw,relatime,fd=6,pgrp=2005,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=40490 0 0
nfs.srv.local:/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

Leave a Comment

Your email address will not be published. Required fields are marked *

Bài viết gần đây:

Shopping Cart