I'm using the -media map attached to /media. The problem is that stale entries for removed CDROMs remain in /media forever. Please note that: 1. Running /etc/autofs/special_media does not show those CDROMs but they are still in /media 2. Even running "/usr/sbin/automount -c" by hand DOES NOT help, the stale entries are still there. Only restarting the automountd and autounmountd daemons removes those entries.
root@vas:~ # automount -cv |& grep -v autofs automount: flushing /media1 root@vas:~ # /etc/autofs/special_media TESTPEN root@vas:~ # ls /media1 Linux Mint 19 Cinnamon 64-bit TESTPEN root@vas:~ #
Really, why does it accumulate all that stale stuff? root@vas:~ # automount -cv |& grep flush automount: flushing autofs caches automount: flushing /media root@vas:~ # /etc/autofs/special_media HAIRCLIPPER root@vas:~ # ls /media da0 da0p2 da0s1 HAIRCLIPPER root@vas:~ #
It's a known issue, I'm afraid, and requires some kernel hacking in autofs(5) to fix. I can provide guidance, but I don't have enough time right now to fix it myself.
(In reply to Edward Tomasz Napierala from comment #3) It is good news at least that this is a known issue :-)
I'm not sure if this is the same issue, but when inserting a media with the same device name as but a different filesystem than a previously mounted FS, it will not be detected. E.g. I have two USB sticks, one with FAT32 and volume ID "SONY8" and another with exFAT, both identified as /dev/da1s1. After accessing the FAT32 FS, the /media/SONY8 directory remains indefinitely and inserting the exFAT stick does not trigger creation of /media/da0s1. It seems a reboot is necessary to clear this condition.
(In reply to Jason W. Bacon from comment #5) autofs is most certainly not ready for production use. When it becomes all stale and stops detecting new media (which happens regularly), I restart the whole thing with the following script: service automountd stop service autounmountd stop umount -Aft autofs service automountd start service autounmountd start automount No need to reboot.
This autofs thing is unusable for any practical purpose. Use sysutils/automount from ports for removable media, it works out of the box. This is probably the reason why noone is willing to fix autofs.