Using AutoFS instead of fstab to mount network shares - any disadvantages?

I’ve been running OSMC on my RPi3 for a while now and I’ve been using cifs mounts in fstab all along. It’s been working fine for the most part, but it’s clunky in handling server and network disconnects. Unfortunately I don’t have a NAS, so I’m mounting network shares from a desktop PC running Windows. Before I had this PC on 24/7, but now I need to have it hibernate during the nights.

It seems fstab mounts (cifs-utils?) can’t handle losing connection to the server. They don’t get remounted when the server is available again with errors and timeouts as a result. I had to manually remount shares after every server hibernation. I got tired of this and tried to find a better solution and found AutoFS.

Now I’ve mounted the same shares with AutoFS and seem to be getting the same performance. It seems like a much better solution; it only mounts on access and automatically unmounts after a selected time of inactivity. No more problems after server hibernation.

So now I’m wondering what the disadvantages of AutoFS is. Why is fstab mounts recommended when AutoFS seems so much better?

noauto and x-systemd.automount in fstab is also a lazy (on access) mount.
x-systemd.idle-timeout will also handle the automatic unmounting and restore the connection promptly if the timeout is set low.

1 Like

I see. I have been using those commands but automatic unmounting has not been working (set to 60s).

My fstab entries looked like this:

//server/share /mnt/share cifs noauto,x-systemd.automount,x-systemd.device-timeout=60,noatime,credentials=pathtocredfile,uid=1000,gid=1000 0 0

After server hibernation or network downtime the mounts were always unavailable and required manual unmount/remount before being accessible again. If I rebooted I got a 90s “Stop job running” timeout for every mount. This problem does not occur with AutoFS.

Should the results be the same using these two methods? Is one to prefer over the other? I’m just happy it’s working and handling server disconnects ATM.