[Guide] Auto-Mounting Filesystems in Linux

Here’s what I’m getting on step zero:

All of those operations succeeded properly. It looks like you had the support libraries installed already, so it just had to install autofs itself. You’re good to proceed with step 1.

1 Like

Thank you. I followed your “Migrating Plex Metadata from Unraid to Ubuntu” guide, so are there any tweaks I need to make from the guide above?

I have my stuff in “/mnt/user/media” in Unraid and mounted as “/media” in Ubuntu for Plex.

If you migrated your metadata, you’re going to need to do a couple extra steps. Autofs needs exclusive access to whatever root folder you point it at. This is fine if you’re pointing it at a subfolder, like the /mnt/nfs folder I use above, but that won’t work if Plex is expecting the media to be in folders directly under the root folder /. The good news is there’s an easy workaround in symbolic links. Follow the guide above as normal, throwing your autofs mounts in /mnt/nfs or whatever subfolder you want under /mnt. Test the mounts to make sure they work, and then, before you reboot, perform the following step for each path you added to autofs:

sudo ln -s /mnt/nfs/tv /tv (Substitute your paths as necessary)

Check that they work by typing ls /tv and verify that your TV folders are listed properly. After you reboot, run the same command again as a final check.

1 Like

having a new issue and need a hand from the masters… i set this up last year and all was working perfectly until maybe a month ago.

i have sonarr/radarr/lidarr on my anniversary build server, and plex on a separate box running ubuntu, as desrcibed by jdm in the transcode post. shares are mounted within ubuntu as per this thread. all was working perfectly but the other week i noticed that the TV episodes stopped pulling into plex automatically. only the tv shows. movies and music worked fine. but on reboot, tv shows would import correctly into plex.

sonarr is working perfectly fine, as is plex – i’ve posting about them in their respective forums and the logs look good. i’ve traced the problem (i think) to the automounting file system.

This is weird: tv shows stream fine and I’m able to view them without any issue at all. But when I check all the shares in /mnt on ubuntu, the /tv share isn’t there! But then I run an ls /mnt command and all three media directories are present but the /tv share is either missing or i cannot cd /mnt/tv into it.

Looks like when I reboot /mnt/tv is there and an ls command works fine. But after a while I lose it.

No clue how or why this is happening, since all 3 directories are located Within the same unraid share and they’re all streaming fine.

any thoughts?

i’ve retraced all my steps using this post and checked that all settings in fstab and autofs are correct, which they are. any help would be greatly appreciated.

I haven’t experienced your issue, so I don’t have a quick answer for you, but I do have a couple suggestions. First, disable the automatic library scan in Plex, and configure Sonarr, Radarr and Lidarr to use Plex Connect to notify Plex when new media is added. To enable Plex Connect, follow these steps in Sonarr, Radarr and Lidarr:

  1. Go to Settings > Connect, and click the add button.
  2. Select Plex Media Server from the available options.
  3. Enter a name for your server at the top
  4. Enter the IP or hostname for your Plex server in the hostname field. Leave all other settings at their defaults.
  5. Click the Authenticate with Plex.tv button and log in to your Plex account.
  6. Click the Test button
  7. If the test was successful, save the connection.

After you’ve enabled the connections, go into your Plex server settings, and disable the options to Scan my library automatically and Run a partial scan when changes are detected. You can leave the periodic scan enabled, and set it to run daily.

Run your system like this for a few days and see if the issue comes up again. If it does, then I’d recommend enabling debug logging for autofs temporarily so the logs can hopefully be used to pinpoint the issue. To enable logging, open the file /etc/autofs.conf in your text editor, scroll down until you see # logging = none, and change it to logging = debug. Save the file, then restart the autofs daemon sudo systemctl restart autofs. Once debug logging is enabled, everything autofs does will be logged in /var/log/syslog, hopefully including whatever is causing the issue. If it comes to this point, please note that the syslog file isn’t used exclusively by autofs, so the relevant information may be scattered among log lines from other programs. I wouldn’t recommend posting the log file anywhere without filtering it first to display only the automount logs.

thanks mthrboard! will make those changes and report back!

If you are like me and named your unraid Share “TV Shows” you will need to take an extra step in your auto fs command. that hinders you from automounting it.

Replace tv with below:
“TV\ Shows”

1 Like

I have migrated successfully to autofs on my system. Interestingly enough, I originally wanted to do this because I was getting “stale file handle” when using fstab. Unfortunately, I am still having the same issue.

In checking the logs, I see the following entries repeatedly:

Apr 9 12:49:51 dionysus kernel: [684639.585302] fsid 0:73: expected fileid 0x901000025857ba7, got 0x27000011a31bce
Apr 9 12:49:51 dionysus kernel: [684639.585797] NFS: server 192.168.86.2 error: fileid changed
Apr 9 12:49:51 dionysus kernel: [684639.585797] fsid 0:73: expected fileid 0x901000025857ba7, got 0x27000011a31bce

I currently trying to figure this out but wondering if this has to do with using cache and then moving to the array? Does anyone have any experience with this?

If you run into stale stale file handlers or similar things, read up on the unraid forums about this hot mess.

The TL;DR; fix: Settings > Global Shares Settings: Shut down array, switch Tunables Hard Links to No.

I’m testing a resolution which is to disable Hard Links on NFS Shares in Unraid 6.8. In the next minor release, there is a slight promise of seeing Hard Links per NFS share.

2 Likes

Thanks very much for this guide! Working great, just have 1 issue which I am hoping you can point me in the right direction for -
Any advice on what would be the best way to set permissions to allow the default ‘plex’ user to be able to delete files through the Plex UI?

Right now when I try to do this I get a permissions error (400) from the logs.
“Jun 28, 2020 14:23:40.641 [0x7f9920cfb700] DEBUG - Completed: [172.16.1.49:53976] 400 DELETE /library/metadata/6473?includeExternalMedia=1 (13 live) TLS GZIP 14ms 463 bytes (pipelined: 13)”

I did a test of trying to change one of the lines in /etc/auto.nfsdb from -fstype=nfs,ro to -fstype=nfs,rw but that didnt seem to work.
Then I added the ‘plex’ user to the group ‘users’ because I see that group has full permissions to all of my folders in /mnt/nfs but not down to the file level which is what I need it seems.

I know that I need to give addtional permissions to the plex user but just not sure of the best/cleanest/easiest way to do it.

What are you using for NAS? I would think the permissions would be controlled there, not on the Plex side.

1 Like

I am able to mount my NFS shares via the autofs guide you have kindly posted. I am however having issues when trying to mount a second drive that is on my network. This one is a mergerfs mount so i believe this should be mounted with the “fuse” para.

this is what i am trying,

mergerfs -fstype=fuse,ro,timeo=100,noatime :192.168.1.10/mnt/user/mount_mergerfs#:192.168.1.10:/mnt/user/mount_mergerfs

We were just talking about this in the Discord. You have to add a _netdev parameter to your fstab

thank you for the link,

So i should now revert back to connecting my drives with fstab and not use autofs?

Wrong issue, Keep calm and configure on.

For those who use PlexDVR, you should change “ro” to “rw”

1 Like

What’s the significance of the prerequisite (disable automatic trash emptying in Plex)? I’m not using any custom posters or metadata so will I be okay to keep automatic emptying enabled?

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.