[Guide] Auto-Mounting Filesystems in Linux

So I specifically joined the forum to come and say THANK YOU for this guide (and also the QSV build guides) - it’s one of the easier to follow autofs guides I ran across in a ton of searching I did recently.

I ran into two headaches I wanted to mention here, and hopefully save some others the trouble, if anyone stumbles this way.

When configuring the /etc/auto.nfsdb file, I made changes to use CIFS instead of NFS, and had to include credentials to access my NAS, which I stored in a separate file so as not to put them in a config file anyone can access.

This:
tv -fstype=nfs,ro,timeo=100,noatime 192.168.1.10:/mnt/user/tv

Became this:
tv -fstype=cifs,ro,timeo=100,noatime,credentials=${HOME}/.smbcredentials,uid=${UID} ://hostname/directory/

I beat my head against a wall for too long before checking system logs and seeing that timeo and noatime are not allowed, for whatever reason. Not sure if it was a CIFS issue or something else I’d done wrong, so I pulled those from the config and it worked wonderfully. Media mounted and I finished migrating my Plex installation (a totally different metadata headache).

If anyone is sharp, they’ll already see my next mistake that kept me searching for a day and reading all the subsequent replies in this thread among many other sites and posts about autofs.

After reboot, Plex was totally unable to access the files. cd to the directory refused to mount it (or I wasn’t patient enough) and navigating to the mount point in the GUI also failed, but only initially. The folder would mount on subsequent navigation attempts and Plex would be happy again, but I couldn’t leave the config in a mode where I had to touch the mount point after ever restart (seldom as they are).

I knew very well that this service account existed already, having used Plex for years on a different system, but it dawned on me when looking at the config file: the Plex user, plex was responsible for first accesses the mount point. If that’s true…it can’t call the credentials that I made, and stored in my home directory, because the autofs config entry is pointed to ${HOME} - the relative location.

Changing the config to this fixed the issue:
tv -fstype=cifs,ro,credentials=/home/someuser/.smbcredentials,uid=${UID} ://hostname/directory/

It mounts it as plex:root when Plex accesses it, which MAY be a problem if something else were to access the mount point first, buuuut I don’t see that happening realistically, and changing the uid variable to be the static plex uid would fix the issue. Alternatively, I could have made a home directory for the plex user and added credentials there (and another account on my NAS) and the ${HOME} variable would have worked, but I wanted to keep them under a user unique to the system itself and generally administer fewer login accounts on the NAS.

Bit of a novel, but I wanted to share, just in case anyone else happened to need this. I realize I made several mistakes here that could have saved me a lot of time (namely checking logs more frequently). Lesson learned.

2 Likes