mounting and unmounting network filesystems in Linux
Table of Contents
definitions#
NFS is one of the network filesystems available on Linux. An NFS server has the NFS service installed and enabled. It hosts the mounted filesystem that shall be made available to remote systems. This action is called export and involves these files:
- /etc/exports: where I configure the mounted filesystems that need to be remotely available to the defined machines,
- /var/lib/nfs/etab: is called the master export table. It is populated as soon as an entry, in a correct format, is recorded in the /etc/exports file and
exportnfs -ais run. Theexportnfs -acommand reads the entries of /etc/exports to do its job. I am simplifying these steps with the expression create an NFS share.
establish a NFS export#
Here is my lab topology: rhel10-vm1 (192.168.122.216): NFS server <—> rhel10-vm2 (192.168.122.6): NFS client.
on the NFS server#
user1@rhel10-vm1:~$ dnf list --installed nfs-utils
Not root, Subscription Management repositories not updated
Installed Packages
nfs-utils.x86_64 1:2.8.3-5.el10_2 @rhel-10-for-x86_64-baseos-rpms
user1@rhel10-vm1:~
I create a sample directory and give full permissions on it to everyone:
user1@localhost:~$ sudo mkdir /common
[sudo] password for user1:
user1@localhost:~$
user1@localhost:~$ sudo chmod ugo+rwx /common
user1@localhost:~$ ls -l /common
total 0
user1@localhost:~$ ls /common
user1@localhost:~$ ls -l / | grep commo
drwxrwxrwx. 2 root root 6 Sep 20 19:09 common
user1@localhost:~$
I allow the NFS service through the Linux firewall:
user1@localhost:~$ sudo firewall-cmd --permanent --add-service nfs
success
user1@localhost:~$
user1@localhost:~$ sudo firewall-cmd --reload
success
user1@localhost:~$
The importance of adding the --permanent option becomes obvious if I restarted the firewalld service after I added the nfs service:
user01@localhost:~$ sudo firewall-cmd --add-service nfs
success
user01@localhost:~$ sudo firewall-cmd --list-services
cockpit dhcpv6-client nfs ssh
user01@localhost:~$ sudo systemctl reload firewall-cmd
Failed to reload firewall-cmd.service: Unit firewall-cmd.service not found.
user01@localhost:~$ sudo systemctl reload firewalld.service
user01@localhost:~$ sudo firewall-cmd --list-services
cockpit dhcpv6-client ssh
user01@localhost:~$
user01@localhost:~$ sudo firewall-cmd --permanent --add-service nfs
[sudo] password for user01:
success
user01@localhost:~$
user01@localhost:~$ sudo systemctl reload firewalld.service
user01@localhost:~$ firewall-cmd --list-services
cockpit dhcpv6-client nfs ssh
user01@localhost:~$
I can verify that the nfs service has been added to firewalld:
user1@rhel10-vm1:~$ sudo firewall-cmd --list-services
cockpit dhcpv6-client nfs ssh
user1@rhel10-vm1:~$
I enable the NFS service unit now:
user1@localhost:~$ sudo systemctl enable --now nfs-server
[sudo] password for user1:
user1@localhost:~$
user1@localhost:~$ man systemctl
user1@localhost:~$ systemctl status nfs-server
● nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; preset: disabled)
Active: active (exited) since Sun 2026-09-20 20:04:16 CEST; 50s ago
Invocation: 9e864420f13a430ea2a4cf4e4699c71c
Docs: man:rpc.nfsd(8)
man:exportfs(8)
Process: 4578 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Process: 4580 ExecStart=/bin/sh -c /usr/sbin/nfsdctl autostart || /usr/sbin/rpc.nfsd (cod>
Process: 4608 ExecStart=/bin/sh -c if systemctl -q is-active gssproxy; then systemctl rel>
Main PID: 4608 (code=exited, status=0/SUCCESS)
Mem peak: 2M
CPU: 18ms
Sep 20 20:04:16 localhost.localdomain systemd[1]: Starting nfs-server.service - NFS server an>
Sep 20 20:04:16 localhost.localdomain systemd[1]: Finished nfs-server.service - NFS server an>
user1@localhost:~$
Since I am going to use hostnames in the /etc/exports file, I update them for my lab machines:
user1@localhost:~$ sudo vim /etc/hostname
[sudo] password for user1:
user1@localhost:~$
I rebooted the machine to see the new hostname. I added an entry to /etc/exports:
user1@rhel10-vm1:~$ cat /etc/exports
user1@rhel10-vm1:~$ cat /common
cat: /common: Is a directory
user1@rhel10-vm1:~$ sudo vim /etc/exports
[sudo] password for user1:
user1@rhel10-vm1:~$
user1@rhel10-vm1:~$ cat /etc/exports
/common rhel10-vm2(rw)
user1@rhel10-vm1:~$
I populate the NFS master table using exportfs which itself uses /etc/exports. Notice that /var/lib/nfs/etab was initially empty then got populated with values:
user1@rhel10-vm1:~$ man exportfs
user1@rhel10-vm1:~$ ls /var/lib/nfs/
etab .etab.lock export-lock nfsdcld/ rpc_pipefs/ statd/
user1@rhel10-vm1:~$ ls /var/lib/nfs/etab
/var/lib/nfs/etab
user1@rhel10-vm1:~$ cat /var/lib/nfs/etab
user1@rhel10-vm1:~$
user1@rhel10-vm1:~$ exportfs -av
exporting rhel10-vm2:/common
exportfs: could not open /var/lib/nfs/.etab.lock for locking: errno 13 (Permission denied)
exportfs: could not open /var/lib/nfs/.etab.lock for locking: errno 13 (Permission denied)
exportfs: can't lock /var/lib/nfs/etab for writing
user1@rhel10-vm1:~$
user1@rhel10-vm1:~$ sudo exportfs -av
[sudo] password for user1:
exporting rhel10-vm2:/common
user1@rhel10-vm1:~$
user1@rhel10-vm1:~$ cat /var/lib/nfs/etab
/common rhel10-vm2(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=65534,anongid=65534,sec=sys,rw,secure,root_squash,no_all_squash)
user1@rhel10-vm1:~$
To remove the export (unexport), I use exportfs with the -u option and give the argument in this form:
{remoteMachine_as_it_appears_in_etc_exports}:{filesystem_mount_point}
user1@rhel10-vm1:~$ sudo exportfs -uv rhel10-vm2:/common
[sudo] password for user1:
unexporting rhel10-vm2:/common
user1@rhel10-vm1:~$
user1@rhel10-vm1:~$ cat /var/lib/nfs/etab
user1@rhel10-vm1:~$
I add the hostname of the NFS client to the /etc/hosts file of the NFS server:
user1@rhel10-vm1:~$ sudo vim /etc/hosts
[sudo] password for user1:
user1@rhel10-vm1:~$ nslookup rhel10-vm2
Server: 192.168.122.1
Address: 192.168.122.1#53
Name: rhel10-vm2
Address: 192.168.122.6
user1@rhel10-vm1:~$
I added the export again before configuring the NFS client:
user1@rhel10-vm1:~$ sudo exportfs -av
exporting rhel10-vm2:/common
user1@rhel10-vm1:~$
Note that lsblk does not help get information on the NFS filesystem because I am not mounting any to the local system. Also, df does not help for the same reason.
user1@rhel10-vm1:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sr0 11:0 1 9.5G 0 rom /mnt
vda 252:0 0 20G 0 disk
├─vda1 252:1 0 1M 0 part
├─vda2 252:2 0 1G 0 part /boot
└─vda3 252:3 0 19G 0 part
├─rhel-root 253:0 0 17G 0 lvm /
└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
user1@rhel10-vm1:~$
user1@rhel10-vm1:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 17G 5.0G 13G 30% /
devtmpfs 825M 0 825M 0% /dev
tmpfs 853M 0 853M 0% /dev/shm
tmpfs 342M 5.5M 336M 2% /run
tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-journald.service
/dev/sr0 9.5G 9.5G 0 100% /mnt
/dev/vda2 960M 465M 496M 49% /boot
tmpfs 171M 72K 171M 1% /run/user/42
tmpfs 171M 56K 171M 1% /run/user/1000
user1@rhel10-vm1:~$
I repeated the exercise on my second home lab. This time I noticed something weird when displaying the content of /var/lib/nfs/etab:
user01@rhel10-vm2:~$ cat /var/lib/nfs/etab
/home rhel10-vm4(ro,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=65534,anongid=65534,sec=sys,ro,secure,root_squash,no_all_squash)
/common rhel10-vm4(ro,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=65534,anongid=65534,sec=sys,ro,secure,root_squash,no_all_squash)
/home *(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=65534,anongid=65534,sec=sys,rw,secure,root_squash,no_all_squash)
/common *(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=65534,anongid=65534,sec=sys,rw,secure,root_squash,no_all_squash)
user01@rhel10-vm2:~$
Why do I see two lines for each NFS export defintion? I inspected /etc/exports again:
user01@rhel10-vm2:~$ cat /etc/exports
/common rhel10-vm4 (rw)
/home rhel10-vm4 (rw)
user01@rhel10-vm2:~$
Nothing seemed to be doubtful at first. So I removed the exports with exportfs -au, deleted all but the first export definition from /etc/exports. This time I removed the space between the NFS client and the permissions:
user01@rhel10-vm2:~$ cat /etc/exports
/common rhel10-vm4(rw)
user01@rhel10-vm2:~$
I checked the NFS Server service unit, generated the NFS exports with exportfs and observed the output:
user01@rhel10-vm2:~$ systemctl status nfs-server.service
● nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; preset: disabled)
Drop-In: /run/systemd/generator/nfs-server.service.d
└─order-with-mounts.conf
Active: active (exited) since Sat 2026-10-03 03:40:46 EDT; 12min ago
Invocation: a2aedba69e3e4cf389d37a630d60073e
Docs: man:rpc.nfsd(8)
man:exportfs(8)
Process: 4334 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Process: 4335 ExecStart=/bin/sh -c /usr/sbin/nfsdctl autostart || /usr/sbin/rpc.nfsd (code=exited, status=0/SUCCESS)
Process: 4355 ExecStart=/bin/sh -c if systemctl -q is-active gssproxy; then systemctl reload gssproxy ; fi (code=exited, status=0/SUCCESS)
Main PID: 4355 (code=exited, status=0/SUCCESS)
Mem peak: 1.7M
CPU: 42ms
Oct 03 03:40:46 rhel10-vm2 systemd[1]: Starting nfs-server.service - NFS server and services...
Oct 03 03:40:46 rhel10-vm2 exportfs[4334]: exportfs: No options for /common rhel10-vm4: suggest rhel10-vm4(sync) to avoid warning
Oct 03 03:40:46 rhel10-vm2 exportfs[4334]: exportfs: No host name given with /common (rw), suggest *(rw) to avoid warning
Oct 03 03:40:46 rhel10-vm2 systemd[1]: Finished nfs-server.service - NFS server and services.
user01@rhel10-vm2:~$
user01@rhel10-vm2:~$ sudo exportfs -avs
[sudo] password for user01:
exporting rhel10-vm4:/common
user01@rhel10-vm2:~$
user01@rhel10-vm2:~$ cat /var/lib/nfs/etab
/common rhel10-vm4(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=65534,anongid=65534,sec=sys,rw,secure,root_squash,no_all_squash)
user01@rhel10-vm2:~$
The result looks cleaner. #LessonLearned In a NFS export definition, there is no space between the NFS client name and the permissions.
on the NFS client#
I add the hostname of the NFS server to the /etc/hosts file of the NFS client:
user1@rhel10-vm2:~$ sudo vim /etc/hosts
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ cat /etc/hosts
# Loopback entries; do not change.
# For historical reasons, localhost precedes localhost.localdomain:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# See hosts(5) for proper format and other examples:
# 192.168.1.10 foo.example.org foo
# 192.168.1.13 bar.example.org bar
192.168.122.216 rhel10-vm1
user1@rhel10-vm2:~$
I install nfs-utils on the NFS client too.
user1@rhel10-vm2:~$ sudo dnf install -y nfs-utils
Updating Subscription Management repositories.
lab2-1-BaseOS 2.7 MB/s | 2.7 kB 00:00
lab2-1-AppStream 2.7 MB/s | 2.8 kB 00:00
Red Hat Enterprise Linux 10 for x86_64 - BaseOS (RPMs) 759 B/s | 4.1 kB 00:05
Red Hat Enterprise Linux 10 for x86_64 - BaseOS (RPMs) 6.4 MB/s | 91 MB 00:14
Red Hat Enterprise Linux 10 for x86_64 - AppStream (RPMs) 779 B/s | 4.1 kB 00:05
Red Hat Enterprise Linux 10 for x86_64 - AppStream (RPMs) 616 kB/s | 6.7 MB 00:11
Dependencies resolved.
==============================================================================================
Package Arch Version Repository Size
==============================================================================================
Installing:
nfs-utils x86_64 1:2.8.3-5.el10_2 rhel-10-for-x86_64-baseos-rpms 494 k
Installing dependencies:
<---- output omitted ---->
Complete!
user1@rhel10-vm2:~$
I can check the status of the NFS client target unit with systemctl status nfs-client.target:
user01@rhel10-vm4:~$ systemctl status nfs-client
Unit nfs-client.service could not be found.
user01@rhel10-vm4:~$ systemctl status nfs-
nfs-blkmap.service nfs-client.target nfs-idmapd.service nfs-mountd.service nfs-server.service nfs-utils.service
user01@rhel10-vm4:~$ systemctl status nfs-client.target
● nfs-client.target - NFS client services
Loaded: loaded (/usr/lib/systemd/system/nfs-client.target; enabled; preset: enabled)
Active: active since Thu 2026-10-01 23:47:19 EDT; 1min 18s ago
Invocation: bcd44d25007b4b0e9ad4c557f13e3de5
Oct 01 23:47:19 rhel10-vm4 systemd[1]: Reached target nfs-client.target - NFS client services.
user01@rhel10-vm4:~$
I created /local on the NFS client which will receive the export from the NFS server. Then I will mount the NFS filesystem on that directory. The mounting step requires knowing the mount point of the remote filesystem, either by having the information already or by discovering it with showmount, executed on the NFS client.
When I do not know which exports the NFS server is presenting, I do the following:
- enable these services on firewalld on the NFS server: rpc-bind, mountd. According to the mountd Linux man pages, mountd is a mount daemon and
showmountwith the-eoption queries it on remote NFS servers to list their NFS exports:
Extract from the mountd man page:
Clients can discover the list of file systems an NFS server is currently exporting,
or the list of other clients that have mounted its exports, by using the show‐
mount(8) command. showmount(8) uses other procedures in the NFS MOUNT protocol to
report information about the server's exported file systems.
Extract from the showmount man page:
DESCRIPTION
showmount queries the mount daemon on a remote host for information about the state
of the NFS server on that machine. With no options showmount lists the set of
clients who are mounting from that host. The output from showmount is designed to
appear as though it were processed through ``sort -u''.
OPTIONS
-a or --all
List both the client hostname or IP address and mounted directory in host:dir
format. This info should not be considered reliable. See the notes on rmtab
in rpc.mountd(8).
-d or --directories
List only the directories mounted by some client.
-e or --exports
Show the NFS server's export list.
I would be using showmount on the NFS client, not the server.
I enabled both services on the NFS server and verify them:
user1@rhel10-vm1:~$ sudo firewall-cmd --list-services
cockpit dhcpv6-client mountd nfs rpc-bind ssh
user1@rhel10-vm1:~$
- enable this service on firewalld on the NFS client: rpc-bind. I believe that when I execute
showmount, the kernel will establish an RPC connection with the NFS server to retrieve the list of NFS exports.
I enabled the rpc-bind firewalld service and verified it:
user1@rhel10-vm2:~$ sudo firewall-cmd --list-services
[sudo] password for user1:
cockpit dhcpv6-client rpc-bind ssh
user1@rhel10-vm2:~$
Then from the NFS client I query the particular NFS server for its NFS export list:
user1@rhel10-vm2:~$ sudo showmount
[sudo] password for user1:
clnt_create: RPC: Program not registered
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ sudo showmount -e rhel10-vm1
Export list for rhel10-vm1:
/common rhel10-vm2
user1@rhel10-vm2:~$
I repeated the exercise again on my second lab, where rhel10-vm2 is the NFS server and rhel10-vm4 is the NFS client. I added the described services to firewalld then did a sudo showmount. It did not display any NFS exports:
user01@localhost:~$ sudo firewall-cmd --list-services
cockpit dhcpv6-client mountd rpc-bind ssh
user01@localhost:~$
user01@localhost:~$ sudo showmount -e
clnt_create: RPC: Program not registered
user01@localhost:~$ sudo showmount -e rhel10-vm2
clnt_create: RPC: Program not registered
user01@localhost:~$ sudo showmount -e rhel10-vm2
clnt_create: RPC: Program not registered
user01@localhost:~$ sudo showmount -e rhel10-vm2
clnt_create: RPC: Program not registered
user01@localhost:~$
I discovered that the nfs-server service was not started on the supposedly NFS server:
user01@localhost:~$ systemctl status nfs-server
○ nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; preset: disabled)
Active: inactive (dead)
Docs: man:rpc.nfsd(8)
man:exportfs(8)
user01@localhost:~$
I started it
user01@localhost:~$ systemctl start nfs-server
user01@localhost:~$
user01@localhost:~$
user01@localhost:~$
user01@localhost:~$ systemctl status nfs-server
● nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; preset: disabled)
Active: active (exited) since Thu 2026-10-01 12:54:55 EDT; 5s ago
Invocation: e9ac3992cc634878961d097d09650333
Docs: man:rpc.nfsd(8)
man:exportfs(8)
Process: 14903 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Process: 14904 ExecStart=/bin/sh -c /usr/sbin/nfsdctl autostart || /usr/sbin/rpc.nfsd (code=exited, status=0/SUCCESS)
Process: 14932 ExecStart=/bin/sh -c if systemctl -q is-active gssproxy; then systemctl reload gssproxy ; fi (code=exited, status=0/SUCCESS)
Main PID: 14932 (code=exited, status=0/SUCCESS)
Mem peak: 1.9M
CPU: 34ms
Oct 01 12:54:54 localhost.localdomain systemd[1]: Starting nfs-server.service - NFS server and services...
Oct 01 12:54:54 localhost.localdomain exportfs[14903]: exportfs: No options for /common rhel10-vm4: suggest rhel10-vm4(sync) to avoid warning
Oct 01 12:54:54 localhost.localdomain exportfs[14903]: exportfs: No host name given with /common (rw), suggest *(rw) to avoid warning
Oct 01 12:54:55 localhost.localdomain systemd[1]: Finished nfs-server.service - NFS server and services.
user01@localhost:~$
Then went back to the NFS client and executed sudo showmount -e again:
user01@localhost:~$ sudo showmount -e rhel10-vm2
Export list for rhel10-vm2:
/common (everyone)
user01@localhost:~$
In either case (available information or queried with showmount -e), the syntax to use for the mount command is as follows:
mount *{NFS_server_hostname}:{NFS_server_export_directory} {NFS_local_mount_point}
user1@rhel10-vm2:~$ sudo mount rhel10-vm1:/common /local
user1@rhel10-vm2:~$
I assumed that lsblk would show me the new NFS share but I was wrong:
user1@rhel10-vm2:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 409.6M 0 disk
├─sda1 8:1 0 9M 0 part
├─sda2 8:2 0 9M 0 part /mnt/mountPoint02
└─sda3 8:3 0 9M 0 part [SWAP]
sdb 8:16 0 409.6M 0 disk
├─sdb1 8:17 0 13M 0 part
└─sdb2 8:18 0 100M 0 part
sdc 8:32 0 409.6M 0 disk
sr0 11:0 1 9.5G 0 rom /mnt/cdrom
vda 252:0 0 25G 0 disk
├─vda1 252:1 0 1M 0 part
├─vda2 252:2 0 1G 0 part /boot
└─vda3 252:3 0 24G 0 part
├─rhel-root 253:0 0 22G 0 lvm /
└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
user1@rhel10-vm2:~$
While reading in the mount man pages, I found out that findmnt is the tool that might show me NFS shares. And it did. The last line is the relevant one:
user1@rhel10-vm2:~$ findmnt
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mapper/rhel-root
│ xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,no
├─/dev devtmpfs
│ │ devtmpf rw,nosuid,seclabel,size=4096k,nr_inodes=213659,mode=755,inod
│ ├─/dev/mqueue mqueue mqueue rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/dev/hugepages hugetlbfs
│ │ hugetlb rw,nosuid,nodev,relatime,seclabel,pagesize=2M
│ ├─/dev/shm tmpfs tmpfs rw,nosuid,nodev,seclabel,inode64
│ └─/dev/pts devpts devpts rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=0
├─/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/selinux
│ │ selinuxfs
│ │ selinux rw,nosuid,noexec,relatime
│ ├─/sys/kernel/tracing
│ │ tracefs
│ │ tracefs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/debug
│ │ debugfs
│ │ debugfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/fuse/connections
│ │ fusectl
│ │ fusectl rw,nosuid,nodev,noexec,relatime
│ ├─/sys/kernel/security
│ │ securityfs
│ │ securit rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup cgroup2
│ │ cgroup2 rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate,memory_r
│ ├─/sys/fs/pstore pstore pstore rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/bpf bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700
│ └─/sys/kernel/config
│ configfs
│ configf rw,nosuid,nodev,noexec,relatime
├─/proc proc proc rw,nosuid,nodev,noexec,relatime
│ └─/proc/sys/fs/binfmt_misc
│ systemd-1
│ autofs rw,relatime,fd=36,pgrp=1,timeout=0,minproto=5,maxproto=5,dir
├─/run tmpfs tmpfs rw,nosuid,nodev,seclabel,size=349228k,nr_inodes=819200,mode=
│ ├─/run/user/1000 tmpfs tmpfs rw,nosuid,nodev,relatime,seclabel,size=174612k,nr_inodes=436
│ ├─/run/credentials/systemd-journald.service
│ │ tmpfs tmpfs ro,nosuid,nodev,noexec,relatime,nosymfollow,seclabel,size=10
│ ├─/run/credentials/serial-getty@ttyS0.service
│ │ tmpfs tmpfs ro,nosuid,nodev,noexec,relatime,nosymfollow,seclabel,size=10
│ └─/run/credentials/getty@tty1.service
│ tmpfs tmpfs ro,nosuid,nodev,noexec,relatime,nosymfollow,seclabel,size=10
├─/boot /dev/vda2
│ xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,no
├─/mnt/mountPoint02
│ /dev/sda2
│ vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=asc
├─/mnt/cdrom /dev/sr0
│ iso9660 ro,relatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=
└─/local rhel10-vm1:/common
nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,ha
user1@rhel10-vm2:~$
or refined by using the -t option:
user1@rhel10-vm2:~$ sudo findmnt -t nfs4
TARGET SOURCE FSTYPE OPTIONS
/local rhel10-vm1:/common nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.122.6,local_lock=none,addr=192.168.12
user1@rhel10-vm2:~$
Or with df:
user1@rhel10-vm2:~$ df -hT /local
Filesystem Type Size Used Avail Use% Mounted on
rhel10-vm1:/common nfs4 17G 5.0G 13G 30% /local
user1@rhel10-vm2:~$
I did another attempt. I repeated the steps. But I could not see the NFS filesystem mounted after system boot, despite a correct entry in /etc/fstab:
user01@localhost:~$ ls /tmp/NFSlocalmp/
user01@localhost:~$ sudo findmnt
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mapper/rhel-root xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota
├─/dev devtmpfs devtmpfs rw,nosuid,seclabel,size=4096k,nr_inodes=213251,mode=755,inode64
│ ├─/dev/hugepages hugetlbfs hugetlbfs rw,nosuid,nodev,relatime,seclabel,pagesize=2M
│ ├─/dev/mqueue mqueue mqueue rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/dev/shm tmpfs tmpfs rw,nosuid,nodev,seclabel,inode64
│ └─/dev/pts devpts devpts rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000
├─/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/selinux selinuxfs selinuxfs rw,nosuid,noexec,relatime
│ ├─/sys/kernel/tracing tracefs tracefs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/debug debugfs debugfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/security securityfs securityfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup cgroup2 cgroup2 rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate,memory_recursiveprot
│ ├─/sys/fs/pstore pstore pstore rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/bpf bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700
│ ├─/sys/kernel/config configfs configfs rw,nosuid,nodev,noexec,relatime
│ └─/sys/fs/fuse/connections fusectl fusectl rw,nosuid,nodev,noexec,relatime
├─/proc proc proc rw,nosuid,nodev,noexec,relatime
│ └─/proc/sys/fs/binfmt_misc systemd-1 autofs rw,relatime,fd=36,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=4716
├─/run tmpfs tmpfs rw,nosuid,nodev,seclabel,size=349244k,nr_inodes=819200,mode=755,inode64
│ ├─/run/user/0 tmpfs tmpfs rw,nosuid,nodev,relatime,seclabel,size=174620k,nr_inodes=43655,mode=700,inode64
│ ├─/run/credentials/systemd-journald.service tmpfs tmpfs ro,nosuid,nodev,noexec,relatime,nosymfollow,seclabel,size=1024k,nr_inodes=1024,mode=700,inode64,noswap
│ ├─/run/user/1000 tmpfs tmpfs rw,nosuid,nodev,relatime,seclabel,size=174620k,nr_inodes=43655,mode=700,uid=1000,gid=1000,inode64
│ │ ├─/run/user/1000/gvfs gvfsd-fuse fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
│ │ └─/run/user/1000/doc portal fuse.portal rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
│ └─/run/media/user01/VBox_GAs_7.2.20 /dev/sr0 iso9660 ro,nosuid,nodev,relatime,nojoliet,check=s,map=n,blocksize=2048,uid=1000,gid=1000,dmode=500,fmode=400,iocharset=utf8
├─/boot /dev/sda2 xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota
├─/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime
└─/mnt/shareddir sharedDir vboxsf rw,nodev,relatime,iocharset=utf8,uid=0,gid=978,dmode=0770,fmode=0770,tag=VBoxAutomounter
user01@localhost:~$
I forced a manual mount:
user01@localhost:~$ sudo mount rhel10-vm2:/common /tmp/NFSlocalmp/
user01@localhost:~$
user01@localhost:~$
user01@localhost:~$ sudo findmnt
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mapper/rhel-root xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota
├─/dev devtmpfs devtmpfs rw,nosuid,seclabel,size=4096k,nr_inodes=213251,mode=755,inode64
│ ├─/dev/hugepages hugetlbfs hugetlbfs rw,nosuid,nodev,relatime,seclabel,pagesize=2M
│ ├─/dev/mqueue mqueue mqueue rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/dev/shm tmpfs tmpfs rw,nosuid,nodev,seclabel,inode64
│ └─/dev/pts devpts devpts rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000
├─/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/selinux selinuxfs selinuxfs rw,nosuid,noexec,relatime
│ ├─/sys/kernel/tracing tracefs tracefs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/debug debugfs debugfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/security securityfs securityfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup cgroup2 cgroup2 rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate,memory_recursiveprot
│ ├─/sys/fs/pstore pstore pstore rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/bpf bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700
│ ├─/sys/kernel/config configfs configfs rw,nosuid,nodev,noexec,relatime
│ └─/sys/fs/fuse/connections fusectl fusectl rw,nosuid,nodev,noexec,relatime
├─/proc proc proc rw,nosuid,nodev,noexec,relatime
│ └─/proc/sys/fs/binfmt_misc systemd-1 autofs rw,relatime,fd=36,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=4716
├─/run tmpfs tmpfs rw,nosuid,nodev,seclabel,size=349244k,nr_inodes=819200,mode=755,inode64
│ ├─/run/user/0 tmpfs tmpfs rw,nosuid,nodev,relatime,seclabel,size=174620k,nr_inodes=43655,mode=700,inode64
│ ├─/run/credentials/systemd-journald.service tmpfs tmpfs ro,nosuid,nodev,noexec,relatime,nosymfollow,seclabel,size=1024k,nr_inodes=1024,mode=700,inode64,noswap
│ ├─/run/user/1000 tmpfs tmpfs rw,nosuid,nodev,relatime,seclabel,size=174620k,nr_inodes=43655,mode=700,uid=1000,gid=1000,inode64
│ │ ├─/run/user/1000/gvfs gvfsd-fuse fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
│ │ └─/run/user/1000/doc portal fuse.portal rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
│ └─/run/media/user01/VBox_GAs_7.2.20 /dev/sr0 iso9660 ro,nosuid,nodev,relatime,nojoliet,check=s,map=n,blocksize=2048,uid=1000,gid=1000,dmode=500,fmode=400,iocharset=utf8
├─/boot /dev/sda2 xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota
├─/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime
├─/mnt/shareddir sharedDir vboxsf rw,nodev,relatime,iocharset=utf8,uid=0,gid=978,dmode=0770,fmode=0770,tag=VBoxAutomounter
└─/tmp/NFSlocalmp rhel10-vm2:/common nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.178.38,local_lock=none,addr=192.1
user01@localhost:~$
I verified the entry in /etc/fstab that I added. I found my mistake: The hostname of the NFS server was wrong:
user01@localhost:~$ tail -n 1 /etc/fstab
rhel10-vm1:/common /tmp/NFSlocalmp nfs4 _netdev 0 0
user01@localhost:~$
I corrected the entry:
user01@localhost:~$ tail -n 1 /etc/fstab
rhel10-vm2:/common /tmp/NFSlocalmp nfs4 _netdev 0 0
user01@localhost:~$
I rebooted and I could see the NFS filesystem being mounted to the mount point path /tmp/NFSlocalmp:
user01@localhost:~$ sudo findmnt -t nfs4
[sudo] password for user01:
TARGET SOURCE FSTYPE OPTIONS
/tmp/NFSlocalmp rhel10-vm2:/common nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.178.38,local_lock=none,addr=192.168.178.36
user01@localhost:~$
At the moment, the /local/ directory is still empty. I created a file on the NFS server under the NFS export directory. I was able to see that file on the mount point on the NFS client:
user1@rhel10-vm2:~$ ls /local
user1@rhel10-vm2:~$
user1@rhel10-vm1:~$ ls /common
user1@rhel10-vm1:~$ touch /common/dummyf1
user1@rhel10-vm1:~$
user1@rhel10-vm2:~$ ls /local
dummyf1
user1@rhel10-vm2:~$
According to the mount man pages, _netdev waits for the network to be established on the local system before mounting a network filesystem.
_netdev
The filesystem resides on a device that requires network access (used to prevent
the system from attempting to mount these filesystems until the network has been
enabled on the system).
So I replaced the defaults userspace mount option with _netdev:
#
# /etc/fstab
# Created by anaconda on Sat Nov 15 11:18:34 2025
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=1cc2a0e5-8ea2-4b31-bbe7-a6d47a824276 / xfs defaults 0 0
UUID=aeaf7891-fb70-4df0-90b6-bbd996703b8d /boot xfs defaults 0 0
UUID=543756ba-806e-4129-bc0b-757fb1e4d832 none swap defaults 0 0
LABEL=MYFATLABEL /mnt/mountPoint02 vfat defaults 0 0
UUID=37775146-fd3b-4e8c-a2a7-96e9798b7006 none swap defaults,pri=1 0 0
rhel10-vm1:/common /local nfs4 _netdev 0 0
~
~
~
user1@rhel10-vm2:~$ sudo findmnt --verify
none
[W] target specified more than once
[W] your fstab has been modified, but systemd still uses the old version;
use 'systemctl daemon-reload' to reload
0 parse errors, 0 errors, 2 warnings
user1@rhel10-vm2:~$ sudo systemctl daemon-reload
Any modifications to the NFS filesystem content on the NFS server will be mirrored on on the mounted NFS filesystem:
- on the NFS client, before file modification on the NFS server:
user1@rhel10-vm2:~$ ls /local
dummyf1
user1@rhel10-vm2:~$ cat /local/dummyf1
user1@rhel10-vm2:~$
- on the NFS client, after file modification on the NFS server:
user1@rhel10-vm2:~$ cat /local/dummyf1
ttt
user1@rhel10-vm2:~$
note on the mount point#
On an NFS client, when the mount point is not empty and I mount a NFS filesystem to it, the content of the local directory gets masked by the content of the mounted NFS filesystem:
user1@rhel10-vm2:~$ sudo findmnt | grep /local
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ sudo touch /local/file.tmp
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ sudo mount rhel10-vm1:/common /local
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ ls /local/
dummyf1
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ sudo umount /local
user1@rhel10-vm2:~$ ls /local/
file.tmp
user1@rhel10-vm2:~$
This behavior is similar to that which I observed with the mount of multiple local filesystems on the storage block devices.
What if I opened a file while the local filesystem is still attached at the mount point and tried to attach the NFS filesystem to the same mount point? To test that, I opened two SSH sessions to rhel10-vm2:
- in the first session, I edited the file.tmp file under the /local/ directory before attaching the NFS filesystem to the mount point, which is also /local/,
- in the second session, I make sure that the process of editing the file.tmp is still active in the first session, and I attach the NFS file system to the /local/ mount point.
Here is the output from the second SSH session:
user1@rhel10-vm2:~$ ps -aux | grep pts/0
user1 5196 0.0 0.4 14776 7196 ? S 05:35 0:00 sshd-session: user1@pts/0
user1 5197 0.0 0.3 8556 5324 pts/0 Ss 05:35 0:00 -bash
user1 5305 0.0 0.5 14792 9848 pts/0 Sl+ 05:52 0:00 vim file.tmp
user1 5374 0.0 0.1 6380 2072 pts/1 S+ 05:55 0:00 grep --color=auto pts/0
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ findmnt | grep common
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ sudo mount rhel10-vm1:/common /local
[sudo] password for user1:
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ findmnt | grep common
└─/local rhel10-vm1:/common nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.122.6,local_lock=none,addr=192.168.122.216
user1@rhel10-vm2:~$ ls /local/
dummyf1
I observed that the NFS filesystem was successfully attached to the mount point despite of having an opened filed on the local filesystem on the mount point. In the first session, after I edited the file.tmp with vim and closed the editor, I was not able to find it again:
user1@rhel10-vm2:~$ vim file.tmp
user1@rhel10-vm2:~$ ls /local
dummyf1
user1@rhel10-vm2:~$
I unmounted the NFS filesystem
user1@rhel10-vm2:~$ sudo umount /local
user1@rhel10-vm2:~$
I verify that df tries to detect the filesystem attached to the mount point given in argument. Since the NFS filesystem was unmounted, df looks for any filesystem attached to /local/. It finds nothing. Then df goes higher in the directory (the /) and looks for a filesystem that is mounted there. It finds /dev/mapper/rhel-root of type XFS. I explained this behavior in this article:
user1@rhel10-vm2:~$ df -hT /local
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/rhel-root xfs 22G 4.2G 18G 19% /
user1@rhel10-vm2:~$
I verified the existence of file.tmp:
user1@rhel10-vm2:~$ ls /local/file.tmp
/local/file.tmp
user1@rhel10-vm2:~$
I assumed the changed I made earlier to the file while I mounted the NFS filesystem were kept. I was wrong:
user1@rhel10-vm2:~$ cat /local/file.tmp
user1@rhel10-vm2:~$
#LessonLearned Do not attach an NFS filesystem to a mount point where files are there or are being edited.
automate mount and unmount of network filesystems using autofs#
the autofs ecosystem#
When autofs is installed and enabled, it calls the automount program, a program that reads the entries in /etc/auto.master and mounts pseudo filesystems of type ‘autofs’ at the mount points mentioned in the content of the map files, which themselves are mentioned in the master map.
The existence of the pseudo filesystems of type autofs at the mount points described by the autofs maps explains why I saw /autodir in the output of findmnt -t autofs.
Each of these pseudo filesystems act as a trigger to mount a remote filesystem (in my case NFS) at a subdirectory of the mount point path (in case of an indirect map) or on top of any mounted filesystems at the full mount point path (in case of direct maps), whenever the subdirectory of the mount point path, or the full mount point path respectively, are accessed, such as by executing a ls command. There are two observations here:
- autofs make use of the concept of maps. A map is a file that describes the mount point, the filesystem to be mounted and the mount options. There is a master map (/etc/auto.master), direct maps and indirect maps. The last two are referenced from within the master map in the form of single-line entries.
- I wrote ‘on top of’ and not ‘at’ to emphasize the filesystem layering property of autofs direct maps; The mount point has already an autofs pseudo filesystem mounted at it. And whenever the autofs pseudo filesystem is triggered, the remote filesystem (in my case NFS) is mounted on top of the same mount point. This is another form of filesystem stacking. The first one I experimented with is documented in my local filesystems and swap archive.
Autofs must be installed on the NFS client, as a DNF package for example. Once installed, /etc/autofs.conf, the configuration file for autofs, becomes available.
user1@rhel10-vm2:~$ more /etc/autofs.conf
#
# Global configuration options.
#
# open_file_limit - set the maximum number of open files. Note there
# may be other limits within the system that prevent
# this from being set, systemd for example may need
# a setting in the unit file to increase its default.
# The autofs default is 20480.
#
#open_file_limit = 20480
#
#
# Define default options for autofs.
#
[ autofs ]
#
# master_map_name - default map name for the master map.
#
#master_map_name = auto.master
#
# timeout - set the default mount timeout in seconds. The internal
# program default is 10 minutes, but the default installed
# configuration overrides this and sets the timeout to 5
# minutes to be consistent with earlier autofs releases.
#
timeout = 300
#
# master_wait - set the default maximum number of retries (actual
# iterations is half this, each is delayed by 2 seconds
# before retrying) waiting for the master map to become
# available if it cannot be read at program start
# (default 10, then continue). This can be longer
# if the map source itself waits for availability
# (such as sss).
#
#master_wait = 10
#
# negative_timeout - set the default negative timeout for
# failed mount attempts (default 60).
#
#negative_timeout = 60
#
<---- output omitted ---->
But the autofs service is at a disabled state:
user1@rhel10-vm2:~$ sudo vim /etc/auto.master.d/auto.dir
[sudo] password for user1:
user1@rhel10-vm2:~$ systemctl status autofs
○ autofs.service - Automounts filesystems on demand
Loaded: loaded (/usr/lib/systemd/system/autofs.service; disabled; preset: disabled)
Active: inactive (dead)
user1@rhel10-vm2:~$
I enabled autofs, created a directory in the Linux tree that will serve as a mount point for the NFS filesystem that will be automatically mounted:
user1@rhel10-vm2:~$ sudo systemctl enable autofs
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ sudo mkdir -pv /autodir
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$
defining and referencing an autofs direct map#
I added an entry to the /etc/auto.master master map, pointing to a user-defined map file I’ve created under /etc/auto.master.d/. I then populated it:
# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
# I added this:
/- /etc/auto.master.d/auto.dir
/misc /etc/auto.misc
#
<---- output omitted ---->
user1@rhel10-vm2:~$ ls -l /etc/auto.master.d/
total 4
-rw-r--r--. 1 root root 28 Sep 25 12:45 auto.dir
user1@rhel10-vm2:~$ cat /etc/auto.master.d/auto.dir
/autodir rhel10-vm1:/common
user1@rhel10-vm2:~$
Entries, in the /auto.master file, which start with /-, reference autofs direct maps. The direct map file is described in the second field of such an entry, in my case it is /etc/auto.master.d/auto.dir.
verifying autofs pseudo filesystems#
Autofs called automount, which successfully mounted an autofs pseudo filesystem at /autodir:
user1@rhel10-vm2:~$ sudo findmnt | grep autodir
├─/autodir /etc/auto.master.d/auto.dir autofs rw,relatime,fd=6,pgrp=2558,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=17240
user1@rhel10-vm2:~$
playing with the timeout#
The timeout directive, in /etc/autofs.conf, defines the maximum time after which autofs calls automount to unmount whatever overlay filesystem exists at the mount points referenced in the autofs maps. If a mount point path is not accessed within the time value specified by the timeout directive in /etc/autofs.conf (which is the configuration file for autofs), automount unmounts the filesystem. That is what I’ve read in the RHCSA book, until I put it under test; I changed the value of timeout from the default of 300 seconds to 60 seconds:
user1@rhel10-vm2:~$ cat /etc/autofs.conf | head -n 30
#
# Global configuration options.
#
# open_file_limit - set the maximum number of open files. Note there
# may be other limits within the system that prevent
# this from being set, systemd for example may need
# a setting in the unit file to increase its default.
# The autofs default is 20480.
#
#open_file_limit = 20480
#
#
# Define default options for autofs.
#
[ autofs ]
#
# master_map_name - default map name for the master map.
#
#master_map_name = auto.master
#
# timeout - set the default mount timeout in seconds. The internal
# program default is 10 minutes, but the default installed
# configuration overrides this and sets the timeout to 5
# minutes to be consistent with earlier autofs releases.
#
timeout = 60
#
# master_wait - set the default maximum number of retries (actual
# iterations is half this, each is delayed by 2 seconds
# before retrying) waiting for the master map to become
user1@rhel10-vm2:~$
I assumed that the NFS filesystem would not be unmounted even after 60 seconds of inactivity in the mount point, because the map I created (so it is a user-defined map) for this NFS export is set up as a direct map in the /etc/auto.master master map, and autofs direct maps allow to mount NFS filesystems and keep them mounted, regardless of whether there is activity in the directory at the mount point. My understanding was wrong. I’ve learned that /autodir is the mount point where autofs creates a pseudo filesystem for mount control. That is because it is defined as an autofs direct map in the /etc/auto.master map. So the pseudo filesystem, created by autofs on the mount point, is omnipresent on /autodir, which explains the result of sudo findmnt | grep autodir.
I expected the automount daemon to unmount the filesystem off /autodir after 60 seconds of inactive interaction with the mount point /autodir. I assusmed that only when the mount point is accessed through a visible action, such as ls, the kernel calls the automount daemon to automount the remote source on that mount point. I assusmed that only when the mount point is accessed through a visible action, such as ls, the kernel calls the automount daemon to automount the remote source on that mount point. That did not happen:
user1@rhel10-vm2:~$ sudo findmnt | grep autodir
├─/autodir /etc/auto.master.d/auto.dir autofs rw,relatime,fd=6,pgrp=2558,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=17240
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ date
Fri Sep 25 01:44:49 PM CEST 2026
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ sudo findmnt | grep autodir
├─/autodir /etc/auto.master.d/auto.dir autofs rw,relatime,fd=6,pgrp=2558,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=17240
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ date
Fri Sep 25 01:54:51 PM CEST 2026
user1@rhel10-vm2:~$
I researched this symptom on redhat.com and learned that the behavior of autofs changed since RHEL5.8 in a way that even kernel processes that emit calls that traverse the mounted filesystem reset the timeout counter. This is the closest explanation to the symptoms I was observing. And this information should have been mentioned in the RHCSA book to remove ambiguity.
removing entries from the master map#
If I configured everything right but removed - or commented out - the entry of the user-defined map from the master map, then autofs will no longer automatically mount the NFS export:
#
# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
# I added this then commented it out:
#/- /etc/auto.master.d/auto.dir
<---- output omitted ---->
I expect the NFS export to immediately get unmounted from the local mount point. I was wrong: I still found it mounted:
user1@rhel10-vm2:~$ sudo vim /etc/auto.master
[sudo] password for user1:
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ sudo findmnt -t autofs
TARGET SOURCE FSTYPE OPTIONS
/proc/sys/fs/binfmt_misc systemd-1 autofs rw,relatime,fd=36,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=5608
/autodir /etc/auto.master.d/auto.dir autofs rw,relatime,fd=6,pgrp=1086,timeout=60,minproto=5,maxproto=5,direct,pipe_ino=9722
/misc /etc/auto.misc autofs rw,relatime,fd=8,pgrp=1086,timeout=60,minproto=5,maxproto=5,indirect,pipe_ino=10402
/net -hosts autofs rw,relatime,fd=11,pgrp=1086,timeout=60,minproto=5,maxproto=5,indirect,pipe_ino=10404
user1@rhel10-vm2:~$
So I assumed that I needed to reload the autofs service. And I believe that made autofs re-read the master map and mount/unmount the NFS filesystems:
user1@rhel10-vm2:~$ sudo systemctl reload autofs.service
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ sudo findmnt -t autofs
TARGET SOURCE FSTYPE OPTIONS
/proc/sys/fs/binfmt_misc systemd-1 autofs rw,relatime,fd=36,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=5608
/misc /etc/auto.misc autofs rw,relatime,fd=8,pgrp=1086,timeout=60,minproto=5,maxproto=5,indirect,pipe_ino=10402
/net -hosts autofs rw,relatime,fd=11,pgrp=1086,timeout=60,minproto=5,maxproto=5,indirect,pipe_ino=10404
user1@rhel10-vm2:~$
trying to automount the same NFS export to two local mount points#
Current situation:
- rhel10-vm1:/common is automounted by autofs on rhel10-vm2:/autodir using the user-defined map /etc/auto.master.d/auto.dir, configured in /etc/auto.master as a direct map. Actions:
- I created /automydir on rhel10-vm2
- I created /etc/auto.master.d/auto.mydir and added one entry:
/automydir rhel10-vm1:/common
- I added an entry for the user-defined map file to the master map as a direct map:
# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
# this was here before:
/- /etc/auto.master.d/auto.dir
# I added this:
/- /etc/auto.master.d/auto.mydir
<---- output omitted ---->
user1@rhel10-vm2:~$ cat /etc/auto.master.d/auto.dir
/autodir rhel10-vm1:/common
user1@rhel10-vm2:~$ cat /etc/auto.master.d/auto.mydir
/automydir rhel10-vm1:/common
user1@rhel10-vm2:~$
- I reloaded the autofs service:
user1@rhel10-vm2:~$ sudo findmnt -t autofs
[sudo] password for user1:
TARGET SOURCE FSTYPE OPTIONS
/proc/sys/fs/binfmt_misc systemd-1 autofs rw,relatime,fd=36,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=5608
/misc /etc/auto.misc autofs rw,relatime,fd=8,pgrp=1086,timeout=60,minproto=5,maxproto=5,indirect,pipe_ino=10402
/net -hosts autofs rw,relatime,fd=11,pgrp=1086,timeout=60,minproto=5,maxproto=5,indirect,pipe_ino=10404
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ sudo systemctl reload autofs.service
user1@rhel10-vm2:~$
Result: the same NFS filesystem was mounted on both local mount points:
user1@rhel10-vm2:~$ sudo findmnt -t autofs
TARGET SOURCE FSTYPE OPTIONS
/proc/sys/fs/binfmt_misc systemd-1 autofs rw,relatime,fd=36,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=5608
/autodir /etc/auto.master.d/auto.dir autofs rw,relatime,fd=14,pgrp=1086,timeout=60,minproto=5,maxproto=5,direct,pipe_ino=20055
/automydir /etc/auto.master.d/auto.mydir autofs rw,relatime,fd=14,pgrp=1086,timeout=60,minproto=5,maxproto=5,direct,pipe_ino=20055
/misc /etc/auto.misc autofs rw,relatime,fd=8,pgrp=1086,timeout=60,minproto=5,maxproto=5,indirect,pipe_ino=10402
/net -hosts autofs rw,relatime,fd=11,pgrp=1086,timeout=60,minproto=5,maxproto=5,indirect,pipe_ino=10404
user1@rhel10-vm2:~$
and obviously, when I modify anything on the NFS export (on the NFS server) both mount points display the same content of the remote NFS filesystem:
user1@rhel10-vm1:~$ cat /etc/exports
/common rhel10-vm2(rw)
user1@rhel10-vm1:~$
user1@rhel10-vm1:~$ ls -l /common
total 4
-rw-r--r--. 1 user1 user1 3 Sep 25 13:36 dummyf1
user1@rhel10-vm1:~$ cat /common/dummyf1
tt
user1@rhel10-vm1:~$ sudo echo 'hello' > /common/dummyf1
user1@rhel10-vm1:~$ cat /common/dummyf1
hello
user1@rhel10-vm1:~$
user1@rhel10-vm2:~$ sudo findmnt -t autofs
TARGET SOURCE FSTYPE OPTIONS
/proc/sys/fs/binfmt_misc systemd-1 autofs rw,relatime,fd=36,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=5608
/autodir /etc/auto.master.d/auto.dir autofs rw,relatime,fd=14,pgrp=1086,timeout=60,minproto=5,maxproto=5,direct,pipe_ino=20055
/automydir /etc/auto.master.d/auto.mydir autofs rw,relatime,fd=14,pgrp=1086,timeout=60,minproto=5,maxproto=5,direct,pipe_ino=20055
/misc /etc/auto.misc autofs rw,relatime,fd=8,pgrp=1086,timeout=60,minproto=5,maxproto=5,indirect,pipe_ino=10402
/net -hosts autofs rw,relatime,fd=11,pgrp=1086,timeout=60,minproto=5,maxproto=5,indirect,pipe_ino=10404
user1@rhel10-vm2:~$ ls /autodir
dummyf1
user1@rhel10-vm2:~$ ls /automydir
dummyf1
user1@rhel10-vm2:~$ cat /autodir/dummyf1
hello
user1@rhel10-vm2:~$ cat /automydir/dummyf1
hello
user1@rhel10-vm2:~$
configuring autofs indirect maps#
I verified that the master map contains an entry for a user-defined map, written in the form of an indirect map, i.e. a key and a value. By default I found a single entry with /misc as the key and /etc/auto.misc as its value.
user1@rhel10-vm2:~$ cat /etc/auto.master
#
# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
# I added these:
/- /etc/auto.master.d/auto.dir
/- /etc/auto.master.d/auto.mydir
/misc /etc/auto.misc
#
<---- output omitted ---->
I populated the user-defined map file with one entry at the end of it. The format of the entry is {subdirectory} {NFS_server_name}:{path_to_NFS_export}
user1@rhel10-vm2:~$ cat /etc/auto.misc
#
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# Details may be found in the autofs(5) manpage
cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
# the following entries are samples to pique your imagination
#linux -ro,soft ftp.example.org:/pub/linux
#boot -fstype=ext2 :/dev/hda1
#floppy -fstype=auto :/dev/fd0
#floppy -fstype=ext2 :/dev/fd0
#e2floppy -fstype=ext2 :/dev/fd0
#jaz -fstype=ext2 :/dev/sdc1
#removable -fstype=ext2 :/dev/hdd
autoindir rhel10-vm1:/common
user1@rhel10-vm2:~$
And I know that autofs is installed. I simply verify that it is running.
user1@rhel10-vm2:~$ systemctl status autofs.service
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/usr/lib/systemd/system/autofs.service; enabled; preset: disabled)
Active: active (running) since Thu 2026-10-01 04:55:31 CEST; 32s ago
Invocation: 3d483543031644098e6c2348e9fe9b60
<---- output omitted ---->
Here is the distinction: with indirect maps, the NFS export is only mounted to the target mount point path when the latter is accessed, such as with ls. Otherwise, only the autofs pseudo filesystem will be visible on the mount point path.
Before accessing the mount point path, notice that there is no filesystem of type nfs4 that is mounted:
user1@rhel10-vm2:~$ sudo findmnt
[sudo] password for user1:
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mapper/rhel-root
│ xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noq
├─/dev devtmpfs
│ │ devtmpf rw,nosuid,seclabel,size=4096k,nr_inodes=213659,mode=755,inode
│ ├─/dev/hugepages
│ │ hugetlbfs
│ │ hugetlb rw,nosuid,nodev,relatime,seclabel,pagesize=2M
│ ├─/dev/mqueue mqueue mqueue rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/dev/shm tmpfs tmpfs rw,nosuid,nodev,seclabel,inode64
│ └─/dev/pts devpts devpts rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=00
├─/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/selinux
│ │ selinuxfs
│ │ selinux rw,nosuid,noexec,relatime
│ ├─/sys/kernel/debug
│ │ debugfs
│ │ debugfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/tracing
│ │ tracefs
│ │ tracefs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/security
│ │ securityfs
│ │ securit rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup
│ │ cgroup2
│ │ cgroup2 rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate,memory_re
│ ├─/sys/fs/pstore
│ │ pstore pstore rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/bpf bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700
│ ├─/sys/kernel/config
│ │ configfs
│ │ configf rw,nosuid,nodev,noexec,relatime
│ └─/sys/fs/fuse/connections
│ fusectl
│ fusectl rw,nosuid,nodev,noexec,relatime
├─/proc proc proc rw,nosuid,nodev,noexec,relatime
│ └─/proc/sys/fs/binfmt_misc
│ systemd-1
│ autofs rw,relatime,fd=36,pgrp=1,timeout=0,minproto=5,maxproto=5,dire
├─/run tmpfs tmpfs rw,nosuid,nodev,seclabel,size=349228k,nr_inodes=819200,mode=7
│ ├─/run/user/1000
│ │ tmpfs tmpfs rw,nosuid,nodev,relatime,seclabel,size=174612k,nr_inodes=4365
│ ├─/run/credentials/systemd-journald.service
│ │ tmpfs tmpfs ro,nosuid,nodev,noexec,relatime,nosymfollow,seclabel,size=102
│ ├─/run/credentials/getty@tty1.service
│ │ tmpfs tmpfs ro,nosuid,nodev,noexec,relatime,nosymfollow,seclabel,size=102
│ └─/run/credentials/serial-getty@ttyS0.service
│ tmpfs tmpfs ro,nosuid,nodev,noexec,relatime,nosymfollow,seclabel,size=102
├─/mnt/mountPoint02
│ /dev/sda2
│ vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=asci
├─/boot /dev/vda2
│ xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noq
├─/var/lib/nfs/rpc_pipefs
│ sunrpc rpc_pip rw,relatime
├─/autodir /etc/auto.master.d/auto.dir
│ autofs rw,relatime,fd=6,pgrp=1086,timeout=60,minproto=5,maxproto=5,d
├─/local rhel10-vm1:/common
│ nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,har
├─/automydir /etc/auto.master.d/auto.mydir
│ autofs rw,relatime,fd=6,pgrp=1086,timeout=60,minproto=5,maxproto=5,d
├─/misc /etc/auto.misc
│ autofs rw,relatime,fd=8,pgrp=1086,timeout=60,minproto=5,maxproto=5,i
└─/net -hosts autofs rw,relatime,fd=11,pgrp=1086,timeout=60,minproto=5,maxproto=5,
user1@rhel10-vm2:~$
I access the subdirectory that I configured in /etc/auto.misc and observe any changes in the output of findmnt:
user1@rhel10-vm2:~$ ls /misc/autoindir
dummyf1
user1@rhel10-vm2:~$
user1@rhel10-vm2:~$ sudo findmnt
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mapper/rhel-root
│ xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noqu
├─/dev devtmpfs
│ │ devtmpf rw,nosuid,seclabel,size=4096k,nr_inodes=213659,mode=755,inode6
│ ├─/dev/hugepages
│ │ hugetlbfs
│ │ hugetlb rw,nosuid,nodev,relatime,seclabel,pagesize=2M
│ ├─/dev/mqueue mqueue mqueue rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/dev/shm tmpfs tmpfs rw,nosuid,nodev,seclabel,inode64
│ └─/dev/pts devpts devpts rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000
├─/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/selinux
│ │ selinuxfs
│ │ selinux rw,nosuid,noexec,relatime
│ ├─/sys/kernel/debug
│ │ debugfs
│ │ debugfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/tracing
│ │ tracefs
│ │ tracefs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/security
│ │ securityfs
│ │ securit rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup
│ │ cgroup2
│ │ cgroup2 rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate,memory_rec
│ ├─/sys/fs/pstore
│ │ pstore pstore rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/bpf bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700
│ ├─/sys/kernel/config
│ │ configfs
│ │ configf rw,nosuid,nodev,noexec,relatime
│ └─/sys/fs/fuse/connections
│ fusectl
│ fusectl rw,nosuid,nodev,noexec,relatime
├─/proc proc proc rw,nosuid,nodev,noexec,relatime
│ └─/proc/sys/fs/binfmt_misc
│ systemd-1
│ autofs rw,relatime,fd=36,pgrp=1,timeout=0,minproto=5,maxproto=5,direc
├─/run tmpfs tmpfs rw,nosuid,nodev,seclabel,size=349228k,nr_inodes=819200,mode=75
│ ├─/run/user/1000
│ │ tmpfs tmpfs rw,nosuid,nodev,relatime,seclabel,size=174612k,nr_inodes=43653
│ ├─/run/credentials/systemd-journald.service
│ │ tmpfs tmpfs ro,nosuid,nodev,noexec,relatime,nosymfollow,seclabel,size=1024
│ ├─/run/credentials/getty@tty1.service
│ │ tmpfs tmpfs ro,nosuid,nodev,noexec,relatime,nosymfollow,seclabel,size=1024
│ └─/run/credentials/serial-getty@ttyS0.service
│ tmpfs tmpfs ro,nosuid,nodev,noexec,relatime,nosymfollow,seclabel,size=1024
├─/mnt/mountPoint02
│ /dev/sda2
│ vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii
├─/boot /dev/vda2
│ xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noqu
├─/var/lib/nfs/rpc_pipefs
│ sunrpc rpc_pip rw,relatime
├─/autodir /etc/auto.master.d/auto.dir
│ autofs rw,relatime,fd=6,pgrp=1086,timeout=60,minproto=5,maxproto=5,di
├─/local rhel10-vm1:/common
│ nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard
├─/automydir /etc/auto.master.d/auto.mydir
│ autofs rw,relatime,fd=6,pgrp=1086,timeout=60,minproto=5,maxproto=5,di
├─/misc /etc/auto.misc
│ │ autofs rw,relatime,fd=8,pgrp=1086,timeout=60,minproto=5,maxproto=5,in
│ └─/misc/autoindir
│ rhel10-vm1:/common
│ nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard
└─/net -hosts autofs rw,relatime,fd=11,pgrp=1086,timeout=60,minproto=5,maxproto=5,i
user1@rhel10-vm2:~$
#QA why hasn’t the NFS filesystem got auto-unmounted after expiration of the timeout that is configured in /etc/autofs.conf?
I repeated the process on home lab 2. I thought everything should run smoothly like the first time but it did not. I was not seeing the autofs pseudo filesystem being mounted at the /misc mount point in the output of findmnt. I verified that the correct entries do exist in the map files. I was not able to list /misc, which created doubt in me that I probably should have created it manually.
user01@localhost:~$ ls -ld /misc
ls: cannot access '/misc': No such file or directory
user01@localhost:~$
user01@localhost:~$ tail -n 3 /etc/auto.misc
# added by me
indmapdir rhel10-vm2:/common
user01@localhost:~$
The thing is, /misc was indeed dynamically created. And my mistake was that I enabled the autofs service unit without starting it.
As soon as I did that, I was able to see the autofs pseudo system mounted at the /misc mount point:
user01@localhost:~$ systemctl status autofs
○ autofs.service - Automounts filesystems on demand
Loaded: loaded (/usr/lib/systemd/system/autofs.service; enabled; preset: disabled)
Active: inactive (dead)
user01@localhost:~$
user01@localhost:~$ sudo systemctl enable --now autofs
user01@localhost:~$ systemctl status autofs
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/usr/lib/systemd/system/autofs.service; enabled; preset: disabled)
Active: active (running) since Thu 2026-10-01 23:01:48 EDT; 1s ago
Invocation: 218b0f8a25b144bbbab045849a00317d
Main PID: 7795 (automount)
Tasks: 6 (limit: 10659)
Memory: 1.7M (peak: 2.2M)
CPU: 23ms
CGroup: /system.slice/autofs.service
└─7795 /usr/sbin/automount --systemd-service --dont-check-daemon
Oct 01 23:01:48 localhost.localdomain systemd[1]: Starting autofs.service - Automounts filesystems on demand...
Oct 01 23:01:48 localhost.localdomain (utomount)[7795]: autofs.service: Referenced but unset environment variable evaluates to an empty string: OPTIONS
Oct 01 23:01:48 localhost.localdomain systemd[1]: Started autofs.service - Automounts filesystems on demand.
user01@localhost:~$
user01@localhost:~$ sudo findmnt
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mapper/rhel-root xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota
├─/misc /etc/auto.misc autofs rw,relatime,fd=6,pgrp=7795,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=72585
├─/dev devtmpfs devtmpfs rw,nosuid,seclabel,size=4096k,nr_inodes=213251,mode=755,inode64
│ ├─/dev/hugepages hugetlbfs hugetlbfs rw,nosuid,nodev,relatime,seclabel,pagesize=2M
│ ├─/dev/mqueue mqueue mqueue rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/dev/shm tmpfs tmpfs rw,nosuid,nodev,seclabel,inode64
│ └─/dev/pts devpts devpts rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000
<---- output omitted --->
However, the mount point, which is the subdirectory that I defined as key in the /etc/auto.misc, was not visible with ls applied on the /misc directory:
user01@rhel10-vm4:~$ ls /misc
user01@rhel10-vm4:~$ ls -l /misc
total 0
user01@rhel10-vm4:~$ cd /misc
user01@rhel10-vm4:/misc$ ls
user01@rhel10-vm4:/misc$ ls -la
total 0
drwxr-xr-x. 2 root root 0 Oct 1 23:47 .
dr-xr-xr-x. 20 root root 258 Oct 1 23:01 ..
user01@rhel10-vm4:/misc$
user01@rhel10-vm4:/$ sudo findmnt
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mapper/rhel-root xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota
├─/dev devtmpfs devtmpfs rw,nosuid,seclabel,size=4096k,nr_inodes=213250,mode=755,inode64
│ ├─/dev/mqueue mqueue mqueue rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/dev/hugepages hugetlbfs hugetlbfs rw,nosuid,nodev,relatime,seclabel,pagesize=2M
│ ├─/dev/shm tmpfs tmpfs rw,nosuid,nodev,seclabel,inode64
│ └─/dev/pts devpts devpts rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000
├─/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/selinux selinuxfs selinuxfs rw,nosuid,noexec,relatime
│ ├─/sys/kernel/debug debugfs debugfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/tracing tracefs tracefs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/security securityfs securityfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup cgroup2 cgroup2 rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate,memory_recursiveprot
│ ├─/sys/fs/pstore pstore pstore rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/bpf bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700
│ ├─/sys/kernel/config configfs configfs rw,nosuid,nodev,noexec,relatime
│ └─/sys/fs/fuse/connections
│ fusectl fusectl rw,nosuid,nodev,noexec,relatime
├─/proc proc proc rw,nosuid,nodev,noexec,relatime
│ └─/proc/sys/fs/binfmt_misc
│ systemd-1 autofs rw,relatime,fd=36,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=4849
├─/run tmpfs tmpfs rw,nosuid,nodev,seclabel,size=349244k,nr_inodes=819200,mode=755,inode64
│ ├─/run/credentials/systemd-journald.service
│ │ tmpfs tmpfs ro,nosuid,nodev,noexec,relatime,nosymfollow,seclabel,size=1024k,nr_inodes=1024,mode=700,ino
│ ├─/run/user/0 tmpfs tmpfs rw,nosuid,nodev,relatime,seclabel,size=174620k,nr_inodes=43655,mode=700,inode64
│ ├─/run/user/1000 tmpfs tmpfs rw,nosuid,nodev,relatime,seclabel,size=174620k,nr_inodes=43655,mode=700,uid=1000,gid=1000,i
│ │ ├─/run/user/1000/gvfs gvfsd-fuse fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
│ │ └─/run/user/1000/doc portal fuse.portal rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
│ └─/run/media/user01/VBox_GAs_7.2.20
│ /dev/sr0 iso9660 ro,nosuid,nodev,relatime,nojoliet,check=s,map=n,blocksize=2048,uid=1000,gid=1000,dmode=500,
├─/boot /dev/sda2 xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota
├─/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime
├─/mnt/shareddir sharedDir vboxsf rw,nodev,relatime,iocharset=utf8,uid=0,gid=978,dmode=0770,fmode=0770,tag=VBoxAutomounter
├─/misc /etc/auto.misc autofs rw,relatime,fd=6,pgrp=1301,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=10681
├─/tmp/NFSlocalmp rhel10-vm2:/common nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=
└─/net -hosts autofs rw,relatime,fd=9,pgrp=1301,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=10691
user01@rhel10-vm4:/$
This confused me and I thought I made a configuration mistake. I assumed that indmapdir would pop up as soon as I list the content of its parent directory, /misc. My assumption was wrong. I observed that as soon as I listed the indmapdir subdirectory, I was able to read its content:
user01@rhel10-vm4:/$ ls misc/indmapdir
file1
user01@rhel10-vm4:/$
And the NFS filesystem seems to have been mounted on top of the autofs pseudo filesystem at the /misc/indmapdir mount point path:
user01@rhel10-vm4:/$ sudo findmnt -t nfs4
[sudo] password for user01:
TARGET SOURCE FSTYPE OPTIONS
/misc/indmapdir
rhel10-vm2:/common
nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.178.38,local
<---- output omitted ---->
And the parent directory, which is configured as key in /etc/auto.master, now displays its content:
user01@rhel10-vm4:/$ ls /misc
indmapdir
user01@rhel10-vm4:/$
#Lessonlearned When using Autofs and indirect maps, the subdirectory that is defined as key of the entry in the indirect map file will only appear in the Linux tree if I access it directly, such as with a ls command. Before that, accessing its parent directory shows nothing.
automatic mounting of remote home directories#
I learned from the RHCSA study book that a use case of autofs and indirect maps is to dynamically mount home directories of users that are created identically on both the NFS server and client, i.e. with the same UID.
I followed the instructions of the book. On the NFS client, the autofs service seems enabled and activated:
user01@rhel10-vm4:~$ systemctl status autofs.service
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/usr/lib/systemd/system/autofs.service; enabled; preset: disabled)
Active: active (running) since Sat 2026-10-03 03:24:40 EDT; 40min ago
Invocation: 05430388a25240cbbd4271ba7d42e370
Main PID: 1378 (automount)
Tasks: 7 (limit: 10659)
Memory: 2.3M (peak: 3.6M)
CPU: 34ms
CGroup: /system.slice/autofs.service
└─1378 /usr/sbin/automount --systemd-service --dont-check-daemon
Oct 03 03:24:40 rhel10-vm4 systemd[1]: Starting autofs.service - Automounts filesystems on demand...
Oct 03 03:24:40 rhel10-vm4 (utomount)[1378]: autofs.service: Referenced but unset environment variable evaluates to an empty string: OPTIONS
Oct 03 03:24:40 rhel10-vm4 systemd[1]: Started autofs.service - Automounts filesystems on demand.
user01@rhel10-vm4:~$ ls /homeOnNFSsrv/
user01@rhel10-vm4:~$
But switching to user02 did not give the expected output as in the exam book. Instead, I received this error:
user01@rhel10-vm4:~$ su - user02
Password:
Last login: Sat Oct 3 04:06:02 EDT 2026 on pts/0
Last failed login: Sat Oct 3 04:12:48 EDT 2026 on pts/0
There was 1 failed login attempt since the last successful login.
su: warning: cannot change directory to /homeOnNFSsrv/user02: No such file or directory
user02@rhel10-vm4:/home/user01$
I verified that:
- the NFS service is allowed through the firewall,
- the mount point where autofs will automatically mount the NFS export does exist,
- the mount point is mentioned as a key in an entry in the autofs master map,
- the entry is in the form of an indirect map,
- the indirect file map is created and contains the definition of the autofs automatic mount,
- the NFS server is reachable.
user02@rhel10-vm4:/home/user01$ exit
logout
user01@rhel10-vm4:~$ sudo firewall-cmd --list-services
[sudo] password for user01:
cockpit dhcpv6-client nfs ssh
user01@rhel10-vm4:~$
user01@rhel10-vm4:~$ ls /homeOnNFSsrv/
user01@rhel10-vm4:~$
user01@rhel10-vm4:~$ grep homeOnNFSsrv /etc/auto.master
/homeOnNFSsrv /etc/auto.master.d/indir1.map
user01@rhel10-vm4:~$
user01@rhel10-vm4:~$ cat /etc/auto.master.d/indir1.map
* -rw rhel10-vm2:/home/user02
user01@rhel10-vm4:~$ nslookup rhel10-vm2
Server: 8.8.8.8
Address: 8.8.8.8#53
** server can't find rhel10-vm2: NXDOMAIN
user01@rhel10-vm4:~$ ping rhel10-vm2
PING rhel10-vm2 (192.168.178.36) 56(84) bytes of data.
64 bytes from rhel10-vm2 (192.168.178.36): icmp_seq=1 ttl=64 time=1.49 ms
64 bytes from rhel10-vm2 (192.168.178.36): icmp_seq=2 ttl=64 time=1.10 ms
^C
--- rhel10-vm2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1003ms
rtt min/avg/max/mdev = 1.102/1.294/1.486/0.192 ms
user01@rhel10-vm4:~$
On the NFS server, the user account has the same UID and the NFS filesystem is exported.
user01@rhel10-vm2:~$ grep user02 /etc/passwd
user02:x:2000:2000::/home/user02:/bin/bash
user01@rhel10-vm2:~$
user01@rhel10-vm2:~$ sudo exportfs -s
[sudo] password for user01:
/common rhel10-vm4(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)
/home rhel10-vm4(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)
user01@rhel10-vm2:~$
Then I thought maybe it is an issue of misaligned permissions. So I added the write permission to the mount point path on the client:
user01@rhel10-vm4:~$ sudo chmod o+w /homeOnNFSsrv/
[sudo] password for user01:
user01@rhel10-vm4:~$
user01@rhel10-vm4:~$ su - user02
Password:
Last login: Sat Oct 3 04:35:00 EDT 2026 on pts/0
su: warning: cannot change directory to /homeOnNFSsrv/user02: No such file or directory
user02@rhel10-vm4:/home/user01$
That did not help. I deleted and recreated the directory. It did not help either. I am probably missing something. Then I thought I needed to check whether the NFS client is really mounting other NFS filesystems from the NFS server either manually or automatically through autofs:
user01@rhel10-vm4:~$ sudo findmnt
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mapper/rhel-root xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota
├─/dev devtmpfs devtmpfs rw,nosuid,seclabel,size=4096k,nr_inodes=213251,mode=755,inode64
│ ├─/dev/hugepages hugetlbfs hugetlbfs rw,nosuid,nodev,relatime,seclabel,pagesize=2M
│ ├─/dev/mqueue mqueue mqueue rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/dev/shm tmpfs tmpfs rw,nosuid,nodev,seclabel,inode64
│ └─/dev/pts devpts devpts rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000
├─/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/selinux selinuxfs selinuxfs rw,nosuid,noexec,relatime
│ ├─/sys/kernel/debug debugfs debugfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/tracing tracefs tracefs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/security securityfs securityfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup cgroup2 cgroup2 rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate,memory_recursiveprot
│ ├─/sys/fs/pstore pstore pstore rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/bpf bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700
│ ├─/sys/kernel/config configfs configfs rw,nosuid,nodev,noexec,relatime
│ └─/sys/fs/fuse/connections
│ fusectl fusectl rw,nosuid,nodev,noexec,relatime
├─/proc proc proc rw,nosuid,nodev,noexec,relatime
│ └─/proc/sys/fs/binfmt_misc
│ systemd-1 autofs rw,relatime,fd=36,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=4865
├─/run tmpfs tmpfs rw,nosuid,nodev,seclabel,size=349244k,nr_inodes=819200,mode=755,inode64
│ ├─/run/user/0 tmpfs tmpfs rw,nosuid,nodev,relatime,seclabel,size=174620k,nr_inodes=43655,mode=700,inode64
│ ├─/run/credentials/systemd-journald.service
│ │ tmpfs tmpfs ro,nosuid,nodev,noexec,relatime,nosymfollow,seclabel,size=1024k,nr_inodes=1024,mode=7
│ ├─/run/user/1000 tmpfs tmpfs rw,nosuid,nodev,relatime,seclabel,size=174620k,nr_inodes=43655,mode=700,uid=1000,gid=
│ │ ├─/run/user/1000/gvfs gvfsd-fuse fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
│ │ └─/run/user/1000/doc portal fuse.portal rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
│ ├─/run/media/user01/VBox_GAs_7.2.20
│ │ /dev/sr0 iso9660 ro,nosuid,nodev,relatime,nojoliet,check=s,map=n,blocksize=2048,uid=1000,gid=1000,dmod
│ └─/run/user/2000 tmpfs tmpfs rw,nosuid,nodev,relatime,seclabel,size=174620k,nr_inodes=43655,mode=700,uid=2000,gid=
├─/boot /dev/sda2 xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota
├─/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime
├─/mnt/shareddir sharedDir vboxsf rw,nodev,relatime,iocharset=utf8,uid=0,gid=978,dmode=0770,fmode=0770,tag=VBoxAutomoun
├─/misc /etc/auto.misc autofs rw,relatime,fd=6,pgrp=1378,timeout=10,minproto=5,maxproto=5,indirect,pipe_ino=11858
├─/NFSLocalmp /etc/auto.master.d/indir1.map
│ autofs rw,relatime,fd=9,pgrp=1378,timeout=10,minproto=5,maxproto=5,indirect,pipe_ino=11869
└─/net -hosts autofs rw,relatime,fd=12,pgrp=1378,timeout=10,minproto=5,maxproto=5,indirect,pipe_ino=11871
user01@rhel10-vm4:~$
I noticed something. The mount point path /NFSLocalmp was an old value of a key in the indir1.map map file. That no longer exists in my indirect map file:
user01@rhel10-vm4:~$ grep indir1.map /etc/auto.master
/homeOnNFSsrv /etc/auto.master.d/indir1.map
user01@rhel10-vm4:~$
Maybe autofs was not able to mount the NFS filesystem, defined in indir1.map, because it thought that is was already mounted at /NFSLocalmp. What if I refreshed the autofs service?
user01@rhel10-vm4:~$ sudo systemctl restart autofs.service
user01@rhel10-vm4:~$ sudo findmnt
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mapper/rhel-root xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota
├─/dev devtmpfs devtmpfs rw,nosuid,seclabel,size=4096k,nr_inodes=213251,mode=755,inode64
│ ├─/dev/hugepages hugetlbfs hugetlbfs rw,nosuid,nodev,relatime,seclabel,pagesize=2M
│ ├─/dev/mqueue mqueue mqueue rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/dev/shm tmpfs tmpfs rw,nosuid,nodev,seclabel,inode64
│ └─/dev/pts devpts devpts rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000
├─/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/selinux selinuxfs selinuxfs rw,nosuid,noexec,relatime
│ ├─/sys/kernel/debug debugfs debugfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/tracing tracefs tracefs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/security securityfs securityfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup cgroup2 cgroup2 rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate,memory_recursiveprot
│ ├─/sys/fs/pstore pstore pstore rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/bpf bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700
│ ├─/sys/kernel/config configfs configfs rw,nosuid,nodev,noexec,relatime
│ └─/sys/fs/fuse/connections
│ fusectl fusectl rw,nosuid,nodev,noexec,relatime
├─/proc proc proc rw,nosuid,nodev,noexec,relatime
│ └─/proc/sys/fs/binfmt_misc
│ systemd-1 autofs rw,relatime,fd=36,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=4865
├─/run tmpfs tmpfs rw,nosuid,nodev,seclabel,size=349244k,nr_inodes=819200,mode=755,inode64
│ ├─/run/user/0 tmpfs tmpfs rw,nosuid,nodev,relatime,seclabel,size=174620k,nr_inodes=43655,mode=700,inode64
│ ├─/run/credentials/systemd-journald.service
│ │ tmpfs tmpfs ro,nosuid,nodev,noexec,relatime,nosymfollow,seclabel,size=1024k,nr_inodes=1024,mode
│ ├─/run/user/1000 tmpfs tmpfs rw,nosuid,nodev,relatime,seclabel,size=174620k,nr_inodes=43655,mode=700,uid=1000,gi
│ │ ├─/run/user/1000/gvfs gvfsd-fuse fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
│ │ └─/run/user/1000/doc portal fuse.portal rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
│ └─/run/media/user01/VBox_GAs_7.2.20
│ /dev/sr0 iso9660 ro,nosuid,nodev,relatime,nojoliet,check=s,map=n,blocksize=2048,uid=1000,gid=1000,dm
├─/boot /dev/sda2 xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota
├─/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime
├─/mnt/shareddir sharedDir vboxsf rw,nodev,relatime,iocharset=utf8,uid=0,gid=978,dmode=0770,fmode=0770,tag=VBoxAutomo
├─/misc /etc/auto.misc autofs rw,relatime,fd=5,pgrp=14058,timeout=10,minproto=5,maxproto=5,indirect,pipe_ino=1691
├─/homeOnNFSsrv /etc/auto.master.d/indir1.map autofs rw,relatime,fd=9,pgrp=14058,timeout=10,minproto=5,maxproto=5,indirect,pipe_ino=1691
└─/net -hosts autofs rw,relatime,fd=12,pgrp=14058,timeout=10,minproto=5,maxproto=5,indirect,pipe_ino=169
user01@rhel10-vm4:~$
Something changed. I noticed the /NFSLocalmp is no longer there and instead a new mount point at /homeOnNFSSrv appeared, which is where the filesystem defined in indir1.map is mounted. That is a good sign. Let me try switching the user account to user02 again:
user01@rhel10-vm4:~$ su - user02
Password:
Last login: Sat Oct 3 04:38:43 EDT 2026 on pts/0
user02@rhel10-vm4:~$
It worked this time!
user02@rhel10-vm4:~$ pwd
/homeOnNFSsrv/user02
user02@rhel10-vm4:~$
#LessonLearned When using autofs to dynamically mount remote home directories of users, the local mount point path does not have to be set with write permissions for the ‘other’ group. #LessonLearned When changing anything either in the autofs master map or an autofs indirect map, always restart the autofs.service unit.
So the updated workflow to automount a remote home directory becomes:
- on the NFS server:
- install nfs-utils
- enable and activate nfs-server
- add nfs service to the firewall rules as permanent
- optional: add rpc-bind and mountd to the firewall rules
- create a user account with a specific UID
- create a password for it
- define /home as a NFS export toward NFS client X, with read and write permissions
- export the NFS filesystem with
exportfs
- on the NFS client:
- install nfs-utils
- add nfs service to the firewall rules as permanent
- optional: add rpc-bind to the firewall rules
- create a directory ‘X’. This is the local mount point path on which the NFS filesystem (the user’s remote home directory) will be automatically mounted by autofs
- create a user account with the same name and UID as on the NFS server, with no home directory, but with the base directory set to ‘X’
- create a password for it
- create an entry for an indirect map in /etc/auto.master. The entry has directory ‘X’ as its key and an indirect map file ‘Y’ as its value. ‘Y’ is located at /etc/auto.master.d/
- create the indirect map file ‘Y’ at /etc/auto.master.d/. Add a line like this: * -rw {NFS_server_hostname}:/home/{user_account}
- restart the autofs.service unit
sudo findmntshould display directory ‘X’ being the mount point for the autofs pseudo filesystem- login with the target user account. The home directory is ‘X’/{user_account}.
What if I had more than one user account whose home directories should be hosted on a central NFS server? For that I created another user account user03 using the same workflow. But I could not load its home directory:
user01@rhel10-vm4:~$ su - user03
Password:
su: warning: cannot change directory to /homeOnNFSsrv/user03: Permission denied
-bash: /homeOnNFSsrv/user03/.bash_profile: Permission denied
user03@rhel10-vm4:/home/user01$
Comparing that with the previous user account login:
user01@rhel10-vm4:~$ su - user02
Password:
Last login: Sat Oct 3 04:40:19 EDT 2026 on pts/0
user02@rhel10-vm4:~$
But I see that user configuration traces are identical between the NFS client and NFS server, also when comparing user02 with user03:
user01@rhel10-vm4:~$ grep -E "user02|user03" /etc/passwd
user02:x:2000:2000::/homeOnNFSsrv/user02:/bin/bash
user03:x:3000:3000::/homeOnNFSsrv/user03:/bin/bash
user01@rhel10-vm4:~$
user01@rhel10-vm2:~$ grep -E "user02|user03" /etc/passwd
user02:x:2000:2000::/home/user02:/bin/bash
user03:x:3000:3000::/home/user03:/bin/bash
user01@rhel10-vm2:~$
The nfs filesystems were mounted correctly to the mount points designated by the respective user account names:
user01@rhel10-vm4:~$ sudo findmnt
[sudo] password for user01:
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mapper/rhel-root
│ xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota
├─/dev devtmpfs devtmpfs rw,nosuid,seclabel,size=4096k,nr_inodes=213251,mode=755,inode64
│ ├─/dev/mqueue mqueue mqueue rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/dev/hugepages hugetlbfs hugetlbf rw,nosuid,nodev,relatime,seclabel,pagesize=2M
│ ├─/dev/shm tmpfs tmpfs rw,nosuid,nodev,seclabel,inode64
│ └─/dev/pts devpts devpts rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000
├─/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/selinux selinuxfs selinuxf rw,nosuid,noexec,relatime
│ ├─/sys/kernel/debug debugfs debugfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/tracing tracefs tracefs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/fuse/connections fusectl fusectl rw,nosuid,nodev,noexec,relatime
│ ├─/sys/kernel/security securityfs security rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup cgroup2 cgroup2 rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate,memory_recursiveprot
│ ├─/sys/fs/pstore pstore pstore rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/fs/bpf bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700
│ └─/sys/kernel/config configfs configfs rw,nosuid,nodev,noexec,relatime
├─/proc proc proc rw,nosuid,nodev,noexec,relatime
│ └─/proc/sys/fs/binfmt_misc systemd-1 autofs rw,relatime,fd=36,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=5529
├─/run tmpfs tmpfs rw,nosuid,nodev,seclabel,size=349244k,nr_inodes=819200,mode=755,inode64
│ ├─/run/credentials/systemd-journald.service
│ │ tmpfs tmpfs ro,nosuid,nodev,noexec,relatime,nosymfollow,seclabel,size=1024k,nr_inodes=1024,mode=700,inode64,noswap
│ ├─/run/user/0 tmpfs tmpfs rw,nosuid,nodev,relatime,seclabel,size=174620k,nr_inodes=43655,mode=700,inode64
│ ├─/run/user/1000 tmpfs tmpfs rw,nosuid,nodev,relatime,seclabel,size=174620k,nr_inodes=43655,mode=700,uid=1000,gid=1000,inode64
│ │ ├─/run/user/1000/gvfs gvfsd-fuse fuse.gvf rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
│ │ └─/run/user/1000/doc portal fuse.por rw,nosuid,nodev,relatime,user_id=1000,group_id=1000
│ └─/run/media/user01/VBox_GAs_7.2.20
│ /dev/sr0 iso9660 ro,nosuid,nodev,relatime,nojoliet,check=s,map=n,blocksize=2048,uid=1000,gid=1000,dmode=500,fmode=400,i
├─/boot /dev/sda2 xfs rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota
├─/var/lib/nfs/rpc_pipefs sunrpc rpc_pipe rw,relatime
├─/mnt/shareddir sharedDir vboxsf rw,nodev,relatime,iocharset=utf8,uid=0,gid=978,dmode=0770,fmode=0770,tag=VBoxAutomounter
├─/misc /etc/auto.misc autofs rw,relatime,fd=6,pgrp=1301,timeout=10,minproto=5,maxproto=5,indirect,pipe_ino=11059
├─/tmp/NFSlocalmp rhel10-vm2:/common
│ nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,c
├─/homeOnNFSsrv /etc/auto.master.d/indir1.map
│ │ autofs rw,relatime,fd=9,pgrp=1301,timeout=10,minproto=5,maxproto=5,indirect,pipe_ino=11082
│ ├─/homeOnNFSsrv/user02 rhel10-vm2:/home/user02
│ │ nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,c
│ └─/homeOnNFSsrv/user03 rhel10-vm2:/home/user02
│ nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,c
└─/net -hosts autofs rw,relatime,fd=12,pgrp=1301,timeout=10,minproto=5,maxproto=5,indirect,pipe_ino=11084
user01@rhel10-vm4:~$
Then I noticed something weird; Why, in the output of findmnt, do I have the same NFS filesystem mounted at two mount points /homeOnNFSsrv/user02 and /homeOnNFSsrv/user03?
user01@rhel10-vm4:~$ sudo findmnt -t nfs4
TARGET SOURCE FSTYPE OPTIONS
/tmp/NFSlocalmp
rhel10-vm2:/common
nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.178.38
/homeOnNFSsrv/user02
rhel10-vm2:/home/user02
nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.178.38
/homeOnNFSsrv/user03
rhel10-vm2:/home/user02
nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.178.38
user01@rhel10-vm4:~$
Could it be due to having more than one user account under the same parent directory /homeOnNFSsrv ? This doubt is reinforced by the statement in the RHCSA exam book that the use of the ampersand symbol (&) substitutes multiple user subdirectories.
I suspected that a single entry in the master map could have been misinterpreted or maybe it was due to having two entries in the indirect map. So I split the entry in two indirect maps: one for user02 and one for user03:
user01@rhel10-vm4:~$ cat /etc/auto.master.d/indir1.map
* -rw rhel10-vm2:/home/user02
* -rw rhel10-vm2:/home/user03
user01@rhel10-vm4:~$
user01@rhel10-vm4:~$ sudo vim /etc/auto.master.d/indir1.map
user01@rhel10-vm4:~$
user01@rhel10-vm4:~$ sudo vim /etc/auto.master.d/indir2.map
user01@rhel10-vm4:~$ cat /etc/auto.master.d/indir2.map
* -rw rhel10-vm2:/home/user03
user01@rhel10-vm4:~$ cat /etc/auto.master.d/indir1.map
* -rw rhel10-vm2:/home/user02
user01@rhel10-vm4:~$ sudo vim /etc/auto.master
user01@rhel10-vm4:~$ sudo systemctl restart autofs.service
user01@rhel10-vm4:~$
user01@rhel10-vm4:~$
user01@rhel10-vm4:~$ grep homeOnNFSsrv /etc/auto.master
/homeOnNFSsrv /etc/auto.master.d/indir1.map
/homeOnNFSsrv /etc/auto.master.d/indir2.map
user01@rhel10-vm4:~$
That changed nothing. So I reverted the changes manually. Then I gave a careful consideration to the meaning of the entry in the indirect map; I interpreted it as ‘any NFS filesystems that are exported from the rhel10-vm2 server are mounted in read/write to /home/user02’. This could be litterally the issue. Some process could be sequentially reading the lines of the indirect map file and trying to mount any NFS filesystem from the NFS server rhel10-vm2 onto /home/user02, including the files of user03. To test this assumption, I deleted the second entry for /home/user03 in the indirect map file and replaced user02 in the first line with the ampersand. I’ve learned this hint from the RHCSA exam book.
user01@rhel10-vm4:~$ sudo rm /etc/auto.master.d/indir2.map
user01@rhel10-vm4:~$ sudo vim /etc/auto.master.d/indir1.map
user01@rhel10-vm4:~$
user01@rhel10-vm4:~$ cat /etc/auto.master.d/indir1.map
* -rw rhel10-vm2:/home/&
user01@rhel10-vm4:~$ sudo vim /etc/auto.master
user01@rhel10-vm4:~$ grep homeOn /etc/auto.master
/homeOnNFSsrv /etc/auto.master.d/indir1.map
user01@rhel10-vm4:~$ sudo systemctl restart autofs
user01@rhel10-vm4:~$ sudo findmnt -t autofs
TARGET SOURCE FSTYPE OPTIONS
/proc/sys/fs/binfmt_misc systemd-1 autofs rw,relatime,fd=36,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=5529
/misc /etc/auto.misc autofs rw,relatime,fd=6,pgrp=6861,timeout=10,minproto=5,maxproto=5,indirect,pipe_ino=61394
/homeOnNFSsrv /etc/auto.master.d/indir1.map autofs rw,relatime,fd=9,pgrp=6861,timeout=10,minproto=5,maxproto=5,indirect,pipe_ino=61398
/net -hosts autofs rw,relatime,fd=12,pgrp=6861,timeout=10,minproto=5,maxproto=5,indirect,pipe_ino=62484
user01@rhel10-vm4:~$ sudo findmnt -t nfs4
TARGET SOURCE FSTYPE OPTIONS
/tmp/NFSlocalmp
rhel10-vm2:/common
nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.178.38,local
user01@rhel10-vm4:~$
Then I retried with user02 to make sure the base working state was preserved. And I opened another shell terminal to verify whether the NFS filesystem on the remote home directory has been locally mounted dynamically:
user01@rhel10-vm4:~$ su - user02
Password:
Last login: Sat Oct 3 12:07:24 EDT 2026 on pts/0
Last failed login: Sat Oct 3 12:13:01 EDT 2026 on pts/0
There was 1 failed login attempt since the last successful login.
user02@rhel10-vm4:~$
user01@rhel10-vm4:~$ sudo findmnt -t nfs4
[sudo] password for user01:
TARGET SOURCE FSTYPE OPTIONS
/tmp/NFSlocalmp
rhel10-vm2:/common
nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.178.38
/homeOnNFSsrv/user02
rhel10-vm2:/home/user02
nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.178.38
user01@rhel10-vm4:~$
I exited the session for user02 and switched to user03. It felt nice to see that the correct remote filesystem, which was on the remote home directory of user03, got mounted at the correct local mount point path: loaded
user02@rhel10-vm4:~$
user02@rhel10-vm4:~$ exit
logout
user01@rhel10-vm4:~$ su - user03
Password:
Last login: Sat Oct 3 12:07:43 EDT 2026 on pts/0
user03@rhel10-vm4:~$
user01@rhel10-vm4:~$
user01@rhel10-vm4:~$ ##### in the other shell terminal, I issued `su - user03`.
user01@rhel10-vm4:~$
user01@rhel10-vm4:~$ sudo findmnt -t nfs4
TARGET SOURCE FSTYPE OPTIONS
/tmp/NFSlocalmp
rhel10-vm2:/common
nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.178.38
/homeOnNFSsrv/user02
rhel10-vm2:/home/user02
nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.178.38
/homeOnNFSsrv/user03
rhel10-vm2:/home/user03
nfs4 rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.178.38
user01@rhel10-vm4:~$
Or with the df -t nfs4 command:
user03@rhel10-vm4:~$ df -t nfs4
Filesystem 1K-blocks Used Available Use% Mounted on
rhel10-vm2:/common 17756160 6647552 11108608 38% /tmp/NFSlocalmp
rhel10-vm2:/home/user02 17756160 6647552 11108608 38% /homeOnNFSsrv/user02
rhel10-vm2:/home/user03 17756160 6647552 11108608 38% /homeOnNFSsrv/user03
user03@rhel10-vm4:~$
#LessonLearned when using autofs to dynamically and automatically mount NFS filesystems of remote home directories of users to a local NFS client, make sure to use this syntax:
* -rw {NFS_server_name}:/home/&
references#
- docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/storage_administration_guide/nfs-autofs
- access.redhat.com/solutions/276773
- RHCSA RHEL10 Training and Exam Preparation Guide, 4th ed, A. Ghori