I used autofs for a several years to mount local network NFS shares. That would get things going on a new machine or fresh install with a small amount of work, but once set up it was rock solid and I never had any issues.
Not too long ago, autofs moved from the official repositories to the AUR. Still worked fine. Then this year, the AUR package started dropping unverified PGP signature errors when trying to update. I left it unupdated for a while, but figured that was a sign that I should probably be migrating to newer systemd automounts.
I got a new machine a while ago, and still got the error trying to install autofs from the AUR. So I looked into systemd automount via fstab. Here’s an example line:
Server:/media/Server/Download /media/Server/Downloads nfs noauto,x-systemd.automount 0 0
That works generally well, and is faster/easier to set up on a new machine or fresh install. However, if “Server” is powered off, or if the client machine has no network access, I get some problems. There is a hang of roughly 10 seconds on login (boot seems fine) compared to login/boot with those fstab entries commented out. Starting up a file manager (I’m in gnome, so nautilus) for the first time after login takes much longer than usual – roughly 30 seconds to 1 minute compared to instant without those fstab entries. And nautilus will also include “filesystem root” and “home” partitions listed in the left panel along with network shares.
With autofs, I had no problems like that. It manages the mounting so that the system doesn’t even try to mount them until/unless I cd or navigate the file manager into the mount points. That is much better behavior even for desktop machines that are almost always on, and basically required for a laptop that I take to other locations where the local “Server” IPs aren’t available, etc.
I thought that the “noauto” line in the fstab entry was supposed to mount only when the mountpoint is accessed, ala autofs, but it seems that is wrong? Arch wiki mentions _netdev option so that systemd knows that the mount is network dependent, but I don’t seem to have problems at boot, so it seems like that isn’t the answer? Maybe I need to add x-systemd.mount-timeout=1s or something, but then I’m not sure if it will try to mount again if I navigate to the mountpoint later (as autofs did)?
I also tried migrating the fstab entries into systemd modules in /usr/lib/systemd/system with one .mount and one .automount module, and systemctl enable-ing only the .automount module (which was suggested in another forum after some google searching), but that seemed to result in the same behavior as the fstab entries.
Anyone know what I need to do to get the better behavior that I had with autofs in addition to the ease and convenience of the systemd automount fstab entries? Thanks!