Shared Media Library over NFS... Caveats?

Hi, I am about to set up a second PMS install on a fast i7 NUC running Ubuntu 18 because my QNAP TVS-473 is just not cutting the mustard for more than transcode at time and sometimes struggles even on one if the original media quality is very good. I would like to at least have more than one choice of PMS instance in my home to stream from or possibly just have the NUC do all the heavy lifting if it can handle multiple transcodes (which from what I have read should be a-ok) and leave the NAS to… well… be a NAS.

Before I embark on sharing my media library on disk between two PMS instances, I wanted to know if there are any particular caveats that I should be aware of when using the same media library on disk where on is local (on the QNAP NAS and the other is shared over NFS4 to the NUC. While each PMS install would certainly be distinct with only the media library itself shared to avoid storage redundancy, I am concerned if there might be file locking issues when reading media if, say, two people wanted to stream the same file separately. Furthermore, is it okay to allow more than one PMS instance to have write access to the library or will than cause mayhem? Since as I understand it metadata appears to be coupled with the PMS install’s database, this is something that cannot be share so presumably things like pulling metadata and such has to be done on each instance. If that is all the case, I would think only concern is for any sort of actual write action on the library itself, such as optimizing, deleting, etc… and whether if collisions/conflicts could lead to badness. Is this something that has been considered in Plex’s design and if so, are their guidelines for this? I figure I can get plenty fast file service over wired switched gigE (with the NAS using link aggregation) so I should hope network bandwidth won’t be a problem, but if it it is would just set up a separate storage network or even iSCSI if need be. One step at a time though.

Any input on this would be appreciated. Thanks.

While my setup is a little different than yours (Windows and FreeBSD based PMS servers and a very old version of FreeNAS (pre iX Systems)), I might be able to help relieve you of some of your concerns…

In my setup, I only have my media files mounted via NFS as read only on my FreeBSD server which is our primary server for streaming and prefer to let the Windows server to do Live TV/DVR duties, any encoding work I do myself with Handbrake, as well as any file management… All my media is encoded to Direct Play to our primary devices, three older Rokus… I don’t share my PLEX with any friends, so the only remote streaming is when the family travels…

When I first started on my path to running two servers it was a Windows server and the FreeNAS box… I was able to use my Windows server’s database after doing some editing, mainly changing the location of my media from mapped drives to UNC path names using this thread, Plex database modification - Moving data the right/wrong way. I still had to re-match a few things but all in all I believe going this route was quicker than re-downloading all the metadata and still having to fix the same files that didn’t match before…

We have never had a problem with multiple streaming the same movie, show, or song at the same time with Direct Play… I have no idea if it works if one of those streams needed transcoding but as long as the server is powerful enough, I see no reason why it wouldn’t…

I few other cavets I can mention is make sure your servers have differnet names… Also, the servers need to use different ports on your router, another words in my setup I use 32410 on the my gateway/router to go to 32400 on one server and 32420 on my gateway/router go to 32400 on the second server… And lastly, permissions are everything!!! Ninety percent of all problems on Linux/Unix are permission related…

I hope this helps you some and with any luck maybe @ChuckPa will chime in, he seems to be the resident Linux guru here and can give you a bit of knowledge and advice…

Good luck!!!

1 Like

Sorry for the delay, It’s been a busy day.

I take it you want to move your PMS from one system to another without all the rematching?

Thanks, this is helpful, particularly as I may simply need to keep the mount read only as you said since the library has been managed by Plex running locally on the NAS and it would probably make sense to keep it that way. I really only need the new Ubuntu instances to transcode as it has a proper cpu. I can continue use the Plex UI on the NAS as I have been previously. I probably should get some more input on my overall approach, but this is viable one and it’s good to know that it works in the field. Thanks!

I take it you want to move your PMS from one system to another without all the rematching?

That would be desirable, but it’s not my primary concern. What is if there are there any established best practice (such as what @bjs59 was able to do) for two Plex instances that would effectively be sharing their media content?
Since I am finding that my QNAP NAS is not packing the punch needed to transcode higher quality video files very well, I was going to attempt running Plex on a much faster Ubuntu 18 NUC and use the existing NAS share Plex via NFS, mounted at /mnt/plex/ there. It took some time to work out a reasonable permissions scheme that would work for Plex running on both the NAS and the NUC, but right off the bat I am not even seeing the media folders are under /mnt/plex/Plex Media Server/Plex Media/ since when using the web UI to pick the media folder /mnt/plex/Plex Media Server/ appears completely empty even though on the CLI using the same user Plex runs as I can view the contents as I’d expect. This seems something Plex-specific that’s preventing me from browsing this directory as I also tried creating a symlink /var/lib/plexmediaserver/Movies -> '/mnt/plex/Plex Media Server/Plex Media/Movies' but trying to browse /var/lib/plexmediaserver (which is Plex’s home) I see the contents of that directory however that symlink Movies which I made is greyed out and untouchable. I’m assuming this is by design for some reason since the media folders are within the Plex installation on my NAS but that’s me speculating.
This is why I am asking if what I am attempting is a bad approach to begin with and if I really want to share said media like this should I try this another way? If it’s not inherently terrible to do this and I am assuming the burden of having both Plex instances of managing their own metadata (though I do see that it is possible to copy it when done correctly), do I need to restructure my hierarchies to allow the Plex instance on the NUC to be able to see it to get around the problem I described or is that the result of some other issue?

Thanks for your help!

I don’t understand why you are trying to mount your media to /mnt/plex/Plex Media Server/… In FreeBSD it’s suggested you mount NFS on /net… Obviously, you can mount wherever you want… But try to follow some kind of hierarchy, it makes life so much easier… To me, it almost looks like you are trying to mount your whole PLEX installation to your Linux box… I think you misunderstood what I did… I only share media between the two servers… I still had to install PLEX on my FreeBSD system… I was able to use my database from the Windows install after a little editing to correct the paths for the FreeBSD server so I didn’t have to re-setup all my libraries and fix every mismatch although I did still had to do a few… From that point on, they are two completely different entities… Keeping track of their own watched shows and the such with their own databases…

On my FreeBSD server I have the following NFS mounts from my NAS for my media:

/net/Movies
/net/Shows
/net/Music

On FreeBSD, the PLEX server is installed at /usr/local/plexdata/Plex Media Server

If I may augment here:

/var/lib/plexmediaserver is reserved for Plex use.

While there is nothing preventing you from placing media directory mounts in there, it is highly frowned on. This is because users often confuse Library with their actual “Media Library” (the files). Putting media here causes as infinite loop of scanning.

1 Like

I don’t understand why you are trying to mount your media to /mnt/plex/Plex Media Server/ … In FreeBSD it’s suggested you mount NFS on /net

Exactly, /net is a FreeBSD thing. In Linux, the convention is all foreign mounts (removable and network media) is on /mnt which I think it borrowed from System V. I agree that /net is makes more sense but it’s been so long since I’ve used FreeBSD (MacOS doesn’t count) so I am just use to using /mnt from muscle memory. In retrospect I would prefer to export just the media and keep the installation local only as I would prefer the installation files to not be exported at all, though I would have the media under one mount and not the three like you have. Having one for each media type seems redundant as I don’t see a reason why you’d need to mount your different media types differently so they may as well share the same options, permissions, etc… under the same export.

The reason I mounted the entire installation is because it is hosted on a QNAP NAS where /Plex is a dedicated share. In QNAP the concept of “share” is a bit more overloaded that standard NAS since QNAP blurs the line between file and application services. The /Plex share is just the file system which I dedicated exclusively for PMS so I could make the most of hardware acceleration features since that is the primary purpose of the NAS: media. The file structure as it stands just the default hierarchy that Plex uses for their .qpkg distribution. I admit that when I set it up I didn’t know how much I could customize or that putting the media in a different location would be beneficial. in retrospect I might have installed PMS with the rest of the QNAP apps but had the media on /Plex exclusively. I may still just make a new share called /Media which would be used both locally and for NFS/CIFS/AFS exports.

In short, the only reason I am jumping through these hoops was in the interests of preserving my current Plex installation without mucking around with it too much. I was not certain that performance on the NUC with an NFS mount would be good out of the gate so I didn’t want to be without a media server by deconstructing the working one. As I said above, I may need to separate the media anyway, but only if I can preserve all my precious metadata.

This is because users often confuse Library with their actual “Media Library” (the files).

Is this why Plex refuses to let me see media in /mnt/plex/Plex Media Server/Plex Media/? I figured it was something like that but this directory only contains media files, not the Plex installation files which need to be local-use-only. This is why I used symlinks once it was mounted so that it wasn’t so messy and risky.

In retrospect I really wish I had put ./Plex Media on the same level as Plex Media Server and not inside it, that was what I did when I didn’t know much about Plex. I may just move it now since you are implying that is the reason I am having this problem. I will just need to make sure I don’t lose my metadata. I will RTFM about how to copy metadata as that will probably tell me how to preserve it in this case.

Thanks.

The TL;DR

  1. Turn off “Empty Trash after Library Scan”
  2. Turn off “Automatically Update my Library”
  3. Make all the moves

With real media files now where you want them

  1. Edit each library section - Folders - ADD the new location (Do not remove the old yet)
  2. Save it
  3. PMS will see the addition and begin scanning.
  4. As each is matched, a 2 will appear (duplicate detection) . This is expected and desired proof.
  5. When completed, Edit the library section again. REMOVE the old media location.
  6. Scan one final time. Observe the 2 being removed.
  7. Empty the Trash
  8. Clean the bundles
  9. Optimize the database
  10. Wash - Rinse - Repeat for each library section until done
  11. Return to Settings - Server - Library, turn Automatic and Empty Trash back on.
2 Likes

Thanks @ChuckPa this is solid. I saw some similar guides but this puts it all together nicely. I will let you know how it goes and whether I ran into anything special by sharing my media.

@ChuckPa @bjs59 I just wanted to let you know that I was able to do what I needed to do but it required that I restructure my install a it, something I should have done from the start. The main thing was to put my media in its own separate share on my QNAP NAS and do what @ChuckPa suggested which worked pretty well. I was going to try my luck moving the metadata from the old server to the new which I guess is an option but I am actually going to try something a little more specific to my needs and that is just sync the play information but maintain my own metadata from scratch. I have some suspicions about how the metadata precedence order works in the agent list (it always was a bit elusive to me) and want to experiment with it using fresh data so I can finally answer some questions about how it really works in the field.

Ultimately, in order to sync the play data between the two servers I am going to try using this plugin and tool which allegedly will do this on the command line assuming you can get a valid access token which I have not been able to do using the instructions provided on the github wiki. (The javascript provided doesn’t seem to work on Chrome or Safari as far as I can tell.) This is ideally all I want to do anyway as I would prefer the new server be free of the kruft of the old server so I don’t port all of my mistakes with me. So far I am astounded at how much better this new server performs. No question, the behavior of a multicore i7 is a lot more responsive than using a QNAP TVS-473 server with a dinky ARM chip. (I mean it works, just not all that well and definitely not with more than one stream.) I even was able to the the experimental player to work most of the time which simply was impossible using the install on the QNAP. Granted, it still crashes the iOS Plex client eventually, but the fact that I could get through an entire movie without it crashing was a first!

Anyway, thanks for your help!

1 Like

I’m a little late to this party. … but for sync between the two plex servers, try using the trakt plug-in - requires a login at trakt.tv though, which might not be desirable for you. I use it to sync between three plex servers and other kodi add-ins as well.

I’m also running three plex servers - one for friends, one for family both in dockers, and one “test” server on a windows 10 desktop. I started by using my “friends” server as my local backup for my media, but I quickly outgrew the backup server capacity so I’m now mounting the “family” server shares on the “friends” box using nsf. I find that watching for folder changes over mounts doesn’t work so I just have plex rescan all libraries twice a day - plenty good for my purposes. You could make it more frequent if you require that.

I’ve never had any issue at all using the same media on two separate plex servers and have streamed the same movie on 3 different clients from both servers at the same time…

I would be careful of that recommendation as a long term solution since Plex has publicly stated it will be removing all Plug-In support (including for Trakt.tv) at some point in the future.

For a short-term solutions to sync 2 different servers watched/unwatched statuses, it works for now.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.