On Solaris, AutoFS is installed by default, and it is easy to access the remote shared directory through the/net/<nfs server>. But on Linux (for example, Fedora or Ubuntu), using AUTOFS requires you to install and configure it yourself. This article will take Ubuntu16.04 as the NFS client and briefly describe how to use AutoFS.
NFS Server:fedora (IPv4 10.66.12.119) NFS Client:ubuntu 16.04 (IPv4 10.66.13.219)
P.S. NFS server is a physical machine, and the NFS client is a virtual machine.
1. Installing the AutoFS Package
sudo Install AutoFS
2. Configuration
2.1 Configure/etc/auto.master, add the following line
/nfs /etc/auto.nfs
2.2 Creating/etc/auto.nfs
Ax -fstype=nfs4 ax:/
Note: Ax is an alias for NFS server. Here, the IPV4 address for NFS server is 10.66.12.119. So, we add the following line in the/etc/hosts
10.66. 12.119 Ax
2.3 Modifying/etc/default/nfs-common
CP /etc/default/nfs-common/tmp/nfs-vi /etc/default/nfs-diff /tmp/ nfs-common/etc/default/nfs-common14c14,< need_gssd=---> #NEED_GSSD = NEED_IDMAPD =Yes> Need_gssd=no
3. Access
3.1 Restart AutoFS
sudo /etc/init.d/autofs restart[OK] restarting AutoFS (via Systemctl): Autofs.service.
3.2 Visit/nfs/ax
$Mount|grepnfs4$ CD /nfs/ Ax$ls-Ltotal8drwxr-xr-x5Root root4096Feb - -: -HOMEDRWXR-xr-x ARoot root4096Nov5 the: *var$Mount|grepNfs4ax:/on/nfs/ax type NFS4 (rw,relatime,vers=4.0, rsize=1048576, wsize=1048576, namlen=255, hard,proto=tcp,timeo= -, retrans=2, sec=sys,clientaddr=10.66.13.219, local_lock=none,addr=10.66.12.119)
Resources
Use AutoFS on Ubuntu16.04