SLES 15
Sponsored Link

Configure NFS Client2019/01/17

 
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.
www:~ #
zypper -n install nfs-client
www:~ #
vi /etc/idmapd.conf
# line 5: uncomment and change to your domain name

Domain =
srv.world
www:~ #
mount -t nfs dlp.srv.world:/home /home

www:~ #
df -hT

Filesystem          Type      Size  Used Avail Use% Mounted on
devtmpfs            devtmpfs  1.8G     0  1.8G   0% /dev
tmpfs               tmpfs     1.9G     0  1.9G   0% /dev/shm
tmpfs               tmpfs     1.9G   17M  1.8G   1% /run
tmpfs               tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/vda2           btrfs      40G  2.3G   38G   6% /
/dev/vda2           btrfs      40G  2.3G   38G   6% /boot/grub2/x86_64-efi
/dev/vda2           btrfs      40G  2.3G   38G   6% /tmp
/dev/vda2           btrfs      40G  2.3G   38G   6% /var
/dev/vda2           btrfs      40G  2.3G   38G   6% /.snapshots
dlp.srv.world:/home nfs4       37G   69M   37G   1% /home
/dev/vda2           btrfs      40G  2.3G   38G   6% /opt
/dev/vda2           btrfs      40G  2.3G   38G   6% /boot/grub2/i386-pc
/dev/vda2           btrfs      40G  2.3G   38G   6% /usr/local
/dev/vda2           btrfs      40G  2.3G   38G   6% /srv
/dev/vda2           btrfs      40G  2.3G   38G   6% /root
tmpfs               tmpfs     371M     0  371M   0% /run/user/0
# home directory from NFS server is mounted

# if mount with NFSv3, add [-o vers=3] option

www:~ #
mount -t nfs -o vers=3 dlp.srv.world:/home /home
[2] Configure NFS mounting on fstab to mount it when the system starts.
www:~ #
vi /etc/fstab
# add NFS mount setting to the end

dlp.srv.world:/home /home                     nfs     defaults 0 0
[3] Configure auto-mounting. For example, set NFS directory on /mntdir.
www:~ #
zypper -n install autofs
www:~ #
vi /etc/auto.master
# add to the end

/-    /etc/auto.mount

www:~ #
vi /etc/auto.mount
# create new : [mount point] [option] [location]

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

www:~ #
mkdir /mntdir

www:~ #
systemctl start autofs

www:~ #
systemctl enable autofs

# move to the mount point to make sure it normally mounted

www:~ #
cd /mntdir

www:/mntdir #
total 0
drwxr-xr-x 7 suse users 201 Jan 11 01:09 suse

www:/mntdir #
cat /proc/mounts | grep mntdir

/etc/auto.mount /mntdir autofs rw,relatime,fd=6,pgrp=2250,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=29516 0 0
dlp.srv.world:/home /mntdir nfs4 rw,relatime,vers=4.1,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.0.0.31,local_lock=none,addr=10.0.0.30 0 0
Matched Content