mount list grows endlessly on automount / autofs setup
I have configured macOS (Catalina 10.15.3) to automount 4 SMB network shares with autofs. It works, the shares are mounted whenever I need them, as they should.
The problem I find is that my mount list grows endlessly. It starts with one "map auto_myshare" line, and more are added over time. I've got to see over 2000 identical mounts:
$ mount
/dev/disk1s1 on / (apfs, local, read-only, journaled)
devfs on /dev (devfs, local, nobrowse)
/dev/disk1s2 on /System/Volumes/Data (apfs, local, journaled, nobrowse)
/dev/disk1s5 on /private/var/vm (apfs, local, journaled, nobrowse)
map auto_home on /System/Volumes/Data/home (autofs, automounted, nobrowse)
/dev/disk2s2 on /Volumes/Storage (exfat, local, nodev, nosuid, noowners)
/dev/disk3 on /Volumes/Backup (hfs, local, nodev, nosuid, journaled)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
map auto_myshares on /Users/me/mnt (autofs, automounted, nobrowse)
The problem is, at some point the system becomes unstable and I need to reboot it.
I've tried a number of things but nothing seems to prevent this list from growing:
- Disabled the Active Directory integration (otherwise auto_home was going nuts) and Symantec antivirus
- Played with large (3600) and small (30) values of
AUTOMOUNT_TIMEOUT
in/etc/autofs.conf
- Doing
automount -vc
adds another line - Killing automount, autofsd
For reference, I've configured my /etc/auto_master
with this line:
/System/Volumes/Data/Users/me/mnt auto_myshares
and /etc/auto_myshares with:
share1 -fstype=smbfs,soft,noowners ://user:passwd@SERVER/share
...
Solution 1:
The solution is to use /etc/fstab
with the net option.
1 - Uncomment this line in /etc/auto_master
:
/Network/Servers -fstab
2 - Fill in fstab as root. For example:
server:/path ignoredmountpoint url net,noowners,url==smb://user:passwd@server/path
...
3 - Run sudo automount -vc
This way, everything is mounted in /Network/Servers automatically on demand and I don't observe multiple mount points anymore.
I think the net option is what makes this work, because I had already tried using fstab before with the same result as an autofs map (i.e. multiple mounts per mountpoint).