[Guide] Auto-Mounting Filesystems in Linux

If your Plex scans while not connected to your networked storage, it will see the content as missing and remove it.

Did you ever figure this one out?

Similar to you, when I have new content added, it won’t show up on plex even doing a forced manual scan library for changes and such. Only way it will populate and “find” newly added content is by me manually rebooting my plex server machine (quicksync laptop) running ubuntu desktop.

The method Plex uses for automatically detecting new files doesn’t work with NFS volumes, so you’ll need to use an alternative method to notify Plex when files are added. Sonarr and Radarr have a connect feature which works perfectly for this, and I documented the exact steps to enable it right in this thread here.

I had been using the fstab method for months without issue… now here just the past few days my Plex would seem to lose access to the NFS shares I’d reboot the Linux box (HP290) and/or the UnRaid server and the shares would reconnect for a day or so and then seem to disappear again (not having touched the Plex box or anything with UnRaid… so goofy)

I’ve move to this autonfs and after some initial fiddling and the NFS shares not showing up, it somehow magically started working (I’m not very Linux savvy). No clue exactly why It wasn’t working and now is.

I am getting these messages now in my UnRaid log for each of my shares…Is there a step or NFS setting on Unraid that I’m missing?

Feb 18 17:31:47 xxxxx rpc.mountd[6135]: No host name given with /mnt/user/tv (ro,async,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,fsid=110,anonuid=65534,anongid=65534,sec=sys,secure,root_squash,no_all_squash), suggest *(ro,async,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,no_pnfs,fsid=110,anonuid=65534,anongid=65534,sec=sys,secure,root_squash,no_all_squash) to avoid warning

Assuming you followed the QuickSync guide, you set the NFS exports to Private which is expecting you to fill out the Rule line with the IP/Hostname of each system you want to be able to access the server, and which permissions each host should get. If you leave it blank, it opens it up as read-only for every host that connects, but then you get that error. To get rid of the error, you either need to add your IP/Host info to the Rule line, or change the NFS export to Secure which exports it as read-only for all systems. Or, you could set it to Public which gives read/write access to any system. Since Plex (usually) doesn’t need write access, Secure is your best bet to prevent accidental deletions.

Thanks… you are correct on both accounts (followed JDM’s QS guide and current NFS shares set to Private) I will test it with Secure. This is the only non-Windows/non-Mac system connecting to my Unraid box, I don’t think I’m using NFS anywhere but for the connection between the Linux Plex box and my shares.

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

No need to apologize for writing a lot! Thanks for sharing your experience.

I need some help troubleshooting why my drives won’t stay mounted.

I was using the original fstab method flawless for nearly a year. After updating to Unraid 6.9 they would unmount overnight. I tried this guide, got everything going but same thing, the drives unmount. Even weirder is the music folder stays mounted, even when i was using fstab it would stay mounted.

This guide assumes that you will have a separate share for each media type (tv, movies, music, etc.). Is there any reason not to use a single share named “media”? I have subfolders in my media share for tv, movies, music etc. which will be used for each of the Plex libraries.

There are tons of reasons not to have a massive media share.

  • different split levels
  • different cache settings/pools
  • different media types (logical)
  • different included/excluded disks
  • passing through different shares with different settings to services such as radarr/sonarr

There are basically no reasons outside of “I’m lazy” to have one massive media share.

Ahh, I see… these are all items that don’t apply to me (yet) since I only have one data disk in my array. I’m probably an atypical user in that all of my media is ripped from physical, and I’m only doing music and shows. That means my library is relatively small, and I don’t expect I’ll run out of space on my 8TB for another 3-5 years.
Is there anything else I should be considering? I’m not opposed to having my mind changed, but I’m not seeing the benefit with my particular use case.

Just because they don’t apply to you now, doesn’t mean that they won’t in the future.
You should really split off your shares into types.

Hey, so I’ve been on a bit of a journey lately after upgrading to 6.9.1 in Unraid. Everything is generally good, but I’ve noticed that every time I reboot the server, I run into “Stale File Handle” for each of my shares.

It’s not a massive issue currently as all I need to do is stop the autofs.service, umount each share, and then restart the service. However, I’m not sure if that is necessary every time or if there is a different work around?

Thanks for any help!

edit - forgot to mention, my Global share settings already has the Tunable (support hard link) set to “No”

Are you running plex scans or are you using sonarr/radarr connect?

Just checked and I’m not using automatic - but I do have the notify feature setup. Again, I only get the issues of stale file handle in ubuntu when I reboot the unraid server. I actually have two unraid servers and TV and Movies live on the different hosts and I’ve experienced the issue when both are rebooted.

Alright. I did it. You win :laughing:

1 Like

I’m a wiener!

Hungry Hot Dog GIF by Stefanie Shank

1 Like

Stuck at step 0

I am no expert but it looks like you have a typo in your file path.
You opened the file “/ect/auto.master” instead of “/etc/auto.master”.

I hope that helps.