So after running Plex Media Server for several years now under Windows 10 Pro, I’ve moved my Plex Media Server back to Linux, specifically, Ubuntu 20.04 Server. Instantly, I noticed that scanning upon “changes to library folders are detected”, doesn’t quite work as I would like it to as it did in Windows 10. And the reason why is, all of my media is stored on a Synology NAS and mounted as a CIFS share under my Ubuntu 20.04 Server running Plex Media Server.
This wasn’t an issue with running Plex Media Server under Windows 10 and having my media on Samba/CIFS shares mounted in Windows. Any changes to my library folders were literally picked up instantly. So after a bit of digging around, when running Plex Media Server under Linux, it relies on the inotify API service to detect changes. However, since it’s a kernel-level subsystem, if the changes to the directory are NOT initiated directly by the same system that Plex Media Server resides on, the kernel has no clue something has changed. CIFS unfortunately exploits this shortfall in the following manner:
Scenario #1: I’m on my Synology via DSM on a web-browser. I open up File Station, upload some videos off my phone and then move them into a directory which Plex Media Server has as a Video library called “Home Videos”. In this case, Plex has NO IDEA there’s new content and doesn’t get picked up until my library scan interval hits.
Scenario #2: I plug my phone via USB into Ubuntu Server which Plex Media Server resides on and shows up as a mass-storage device where I can access my media files. I copy the videos off my phone directly onto the CIFS share off my Synology which is my Video library called “Home Videos”. In this case, Plex INSTANTLY picks up there’s new content and adds it immediately to my library.
So, in a nutshell, I’m wondering if anyone has tried attacking this issue with a workaround. I do NOT manage my Plex Media Server library directly on the same server itself. Usually, it’s either directly on my Synology or on another machine (i.e. I copy my videos or pictures to a notebook computer and then upload them to my Synology). Both cases, Linux inotify has no clue something has changed on the CIFS share.
Obviously, a work around is running a Library scan interval at 15 minutes is a work around but a horrible one. The nice thing about the “partial scan” is that it only scans and updates the changes vs. scanning ALL my libraries with thousands of directories, just to add a couple, or even just one thing to my library.
The other obvious work around is running Plex Media Server directly off my Synology, but for many reasons, I do not and will not go that route.
So if anyone, again, has any suggestions or work arounds, would be greatly appreciated. Thanks in advance.
EDIT: One thing that did cross my mind, was building a simple service which runs on the same server as Plex Media Server (Linux) that continuously monitors my Libraries located on CIFS mounts. And if it detects a new directory or a change to a directory, it creates a 0-byte file named foo in that directory which triggers an inotify event. Then deletes the file.
When I was testing earlier in Scenario #1, if I was SSH’ed into the Ubuntu server which Plex Media Server was running on, I go into the directory where there’s new content but hasn’t been picked up yet, if I did a touch foo in that directory, Plex Media Server almost immediately detects the new content and adds it to my library. Likely, because my action triggered inotify since it was done directly on the system.
