Debian 10 Buster
Sponsored Link

NFS : Configure NFS Client2019/07/17

 
Configure NFS Client.
This example is based on the environment below.
+----------------------+          |          +----------------------+
| [    NFS Server    ] |10.0.0.30 | 10.0.0.51| [    NFS Client    ] |
|     dlp.srv.world    +----------+----------+    node01.srv.world  |
|                      |                     |                      |
+----------------------+                     +----------------------+

[1] Configure NFS Client. On this example, Mount [/home] directory from NFS server.
root@node01:~#
apt -y install nfs-common
root@node01:~#
vi /etc/idmapd.conf
# line 6: uncomment and change to your domain name

Domain =
srv.world
root@node01:~#
mount -t nfs dlp.srv.world:/home /home

root@node01:~#
df -hT

Filesystem                  Type      Size  Used Avail Use% Mounted on
udev                        devtmpfs  2.0G     0  2.0G   0% /dev
tmpfs                       tmpfs     395M   11M  385M   3% /run
/dev/mapper/debian--vg-root ext4       26G  1.1G   23G   5% /
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/vda1                   ext2      236M   48M  176M  22% /boot
tmpfs                       tmpfs     395M     0  395M   0% /run/user/0
dlp.srv.world:/home         nfs4       26G  1.1G   23G   5% /home
# /home from NFS server is mounted

# if you'd like to mount with NFSv3, add '-o vers=3' option

root@node01:~#
mount -t nfs -o vers=3 dlp.srv.world:/home /home

[2] Configure NFS mounting on fstab to mount it when the system boot.
root@node01:~#
vi /etc/fstab
# add to the end like follows

dlp.srv.world:/home   /home  nfs     defaults        0       0
[3] Configure auto-mounting if you need. For example, set NFS directory on /mntdir.
root@node01:~#
apt -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]

/mntdir -fstype=nfs,rw  dlp.srv.world:/home

root@node01:~#
mkdir /mntdir

root@node01:~#
systemctl restart autofs
# move to the mount point to verify it works normally

root@node01:~#
cd /mntdir

root@node01:/mntdir#
total 4
drwxr-xr-x 2 debian debian 4096 Jul  8 19:02 debian

root@node01:/mntdir#
cat /proc/mounts | grep mntdir

/etc/auto.mount /mntdir autofs rw,relatime,fd=6,pgrp=2132,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=23558 0 0
dlp.srv.world:/home /mntdir 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.31,local_lock=none,addr=10.0.0.30 0 0
Matched Content