[Guide] Auto-Mounting Filesystems in Linux

Hi

Thank you for the great guide. Just one question. I have a few shows on plex that after i watch an episode i like it to be deleted. Since i have my media on my unraid server and then plex on my ubuntu pc this no longer works. I assume this is a permissions issue but cant figure out where i need to make the change.

thanks

In step 1, you need to set the permissions to read/write instead of read only.

This is the original example line in your nano file:

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

Instead of “ro”, put “rw”, like so:

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

To make this change just Run sudo nano /etc/auto.nfsdb, edit it as I outline above, and save the file.

1 Like

Just changing ro to rw on the Ubuntu side won’t have any effect. You need to adjust the NFS exports on the unraid side as well. If you followed the QuickSync guide to the letter, you exported the NFS mounts as Private, which only allows Read-Only access to all other systems unless you explicitly add a rule to give them Read-Write access. There are two ways to update the unraid side.

Option 1, the easy method, is to change the NFS exports back to Public, which allows Read-Write access to all systems. If you trust the other devices on your network, the Public option is what I would use.

Option 2, the secure method, is to add rules to the existing exports to allow Read-Write access to the systems you specify. To do this, in each share, under the NFS Security Settings in the Rules box, enter the IP of your Plex system with (rw) at the end. For example, 192.168.10.10(rw). If you need to share with multiple systems, add all their IPs separated by spaces, like this: 192.168.10.10(rw) 192.168.10.20(rw) 192.168.10.30(ro). And finally, if you want any other systems besides the ones you specify to still have access to the NFS export, add a wildcard *(ro) to the end. Rinse and repeat for each share where you want write access for some systems.

3 Likes

Thank you for the responses. I will makes the changes when i have some more time to spend.

Wow, I hadn’t realized this! My plex database backup folder has been empty this whole time :open_mouth:

I’m digging this all, moving from Windows Plex to Ubuntu plex.

Using the mounting method, though, active scanning isn’t really functional the way it is for a local/same-machine share. The internet has half-ass solutions, such as what to do if on Synology, or using Sonarr/Radarr scripts.

For someone who has Unraid with media, mounting onto Ubuntu machine, any ideas how autoscan can pick up new media as they arrive onto Unraid?

Why do you need to autoscan?

Tell Sonarr/Radarr to communicate with Plex directly.

I use a seedbox that runs sonarr/radarr. I pull files through ssh but leave sonarr/radarr “virtual”

Ok, so why can’t that inform your plex?

Plex’s automatic library update relies on a linux program inotify to monitor your library folders for new/updated content. Unfortunately inotify does not work over network filesystems, so Plex is never notified when new content is added. The Sonarr/Radarr connect feature solves this problem. Add your Plex server in the Connect tab and Sonarr/Radarr will tell Plex when they’ve added new media, so Plex can scan the new files, match, and grab metadata. They don’t even need to be on the same system, as long as Sonarr/Radarr can reach Plex over the network.

4 Likes

Noticed that there is an issue impacting some Unraid users that use NFS. https://forums.unraid.net/bug-reports/stable-releases/683-shfs-error-results-in-lost-mntuser-r939/

Is there any chance that autofs works with SMB shares? :sweat_smile:

That’s 6.8.3. Are you running a release that’s that old?

I was on 6.9.2 but upgraded to the 6.10-rc in hopes it would help. Sadly it hasn’t.

Turn off hardlinks.

1 Like

Autofs should work with basically any filesystem that linux can read, local or remote. You can follow most of the same instructions up top to mount CIFS (samba) shares, you would just need to modify step 1 as follows:

First, on the unraid machine, if you haven’t already created one, add a user that has access to the shares you want. Make sure you set a password for the user. It only needs to be read-only access for standard Plex usage.

Next, run sudo nano /etc/auto.master. At the bottom, add the following:

/mnt/smb /etc/auto.smbdb --timeout=0 --browse

Temporarily disable the NFS automount by putting a hash tag in front of it

#/mnt/nfs /etc/auto.nfsdb --timeout=0 --browse

Save the file and close it.

Now, run sudo nano /etc/auto.smbdb

This will open a blank file. For every share you want to mount, add a line like the following:

tv -fstype=cifs,ro,credentials=/root/.smbpassword ://192.168.1.10/tv

You’ll notice it’s similar to the NFS method, with the IP and share name, but has a couple different options, mainly credentials=/root/.smbpassword. The same rules as above apply, with case-sensitive folder names and options.

Once you have all the shares added, save and close the file.

Next, run sudo nano /root/.smbpassword. This will open another blank file where you need to store the username and password for your samba shares. This file needs 2 lines in it:

username=mthrboard
password=MySecurePassword

As always, this is case-sensitive, and the syntax needs to be precise. No spaces before or after the equals sign, and no other lines in the file. Save the file and close your editor.

Because this file contains your password in plain text, next you want to make sure that only the root user can see it. Run sudo chmod 600 /root/.smbpassword, which will change permissions on the file so only root can read it or write to it.

Once this is all done, you can proceed with the rest of the steps as written.

2 Likes

I’ll try the overlords way first as I still had hardlinks on. Always appreciate a writeup/guide from Mthrboard!

When you turn hardlinks off, make sure to reboot both the NAS and the Plex server.

So I’ve noticed something weird after a power outage (everything was shutdown properly since it is on a UPS).

When I reboot everything, if my ubuntu plex server comes up before unraid it doesn’t recognize the libraries until I reboot my plex server. Is there a way to fix this without having to delay the booting of my plex server or rebooting it after unraid is up?

This is expected. It can’t mount the share if the share is not online at the time of connection.

That’s what I thought. Is there anyway for me to recheck for the share without rebooting or does it require a reboot?