Auto detect new media no working. Permissions?

Server Version#: 1.41.5.9522
Player Version#: 4.145.1
<If providing server logs please do NOT turn on verbose logging, only debug logging should be enabled>

Hello,

I just successfully moved my Plex install to a new Ubuntu Server VM following this guide. Everything seems to be behaving properly except that new media added to a folder doesn’t automatically get detected. I have to do a manual scan, then it is added.

Plex/Ubuntu maps a shared drive to /Media and repeats this via /etc/fstab
Here is the share drive from the server:

plex@plex:/Media$ ls -al
total 4
drwxrwxrwx  2 root root    0 Mar 19 15:44 .
drwxr-xr-x 24 root root 4096 Mar 18 18:28 ..
drwxrwxrwx  2 root root    0 Mar 20 01:35 tmp
drwxrwxrwx  2 root root    0 Mar 30  2017 ts
drwxrwxrwx  2 root root    0 Mar 19 14:01 tv

While reading this post, it seems like I may need to change ownership of /Media & files to plex:plex, but at the same time, it says it just needs access, which is definitely accomplished with 777 (I know, not best practice).

So, if rights isn’t an issue, does anyone have any ideas of what it could be?

Also, I’ve tried disabling/enabling the auto scan and media detection options.

Thanks for any advice

Before you mounted the shared folder (/Media),

did you also execute chmod 755 /Media ?

This is important because it allows user plex read permission in the root filesystem (/Media).

Then, after you mount the shared folder, the permissions of the share will be seen.

Can you also,

  1. Make certain DEBUG logging is enabled, (SAVE if you make changes)
  2. Restart PMS
  3. Wait about 3 minutes for the “watch” list to load
  4. Download the logs ZIP file
  5. Attach here.

I request this because if the inotify table (which the watch list uses) is already full, it won’t auto detect anything more until the table size is increased

Thanks for taking the time to respond.

I have not done the chmod 755 /Media – I created the /Media folder, then created the /etc/fstab remount, then mounted. Maybe this was an error, or an order of operations error?

Per my output above, all files and folders within /Media are 777 (rwxrwxrwx). Doesn’t that mean that plex, who would be part of Others, has full access?

Sorry if I’m misunderstanding. Should I just chmod 755 or change the user:group to plex:plex?

Once I know the correct permissions that /Media should be, I’ll look at enabling & seeing the logs.

Thanks again!

So we’re clear,

  1. There is a default /media (lowercase)
  2. You created a /Media (Capitalized)
  3. You’re using /Media ?

I am confirming because:

  1. When using the graphical desktop. /media is reserved for gnome Nautilus (the automounter)
  2. Nautilus will take exclusive control of /media and grant only your username access. User plex won’t have access even when chmod 777 is applied.

If you’ve not done the unmounted chmod then the solution is simple:

  1. Stop Plex
  2. Unmount the filesystem
  3. chmod 755 /Media
  4. Mount
  5. Start Plex

Hi ChuckPa, thanks again for taking the time.

Confirmed I am using /Media and not /media

I tried what you said:

  1. sudo systemctl stop plexmediaserver
  2. sudo umount /Media
  3. sudo chmod 755 /Media
    3.1. even did 'sudo chown plex:plex /Media
  4. sudo mount -a (/Media is only drive in /etc/fstab)
  5. sudo systemctl start plexmediaserver

Unfortunately, when I drag over new media to the folder, nothing shows up in Plex until I manually initiate a “Scan Library”

I believe at this point it’s something to do with my /etc/fstab. the smb user is ‘plex’, but do you think it’s because /etc/fstab is run at startup by root, so the user:group is that? Would that change if I put the credentials file in /home/plex ?

/etc/fstab:
//192.x.x.x/plex /Media cifs credentials=/etc/smb,iocharset=utf8,file_mode=0777,dir_mode=0777,nofail 0 0

I’m always concerned about using SMB protocol on a Linux host..
If you’re using a QNAP / Synology / or other Linux-based server, NFS is the better method. We’ll address that later.

First, let’s find out why you’re not getting media inotify

find /Media -type d -print | wc -l
sudo sysctl fs.inotify.max_user_watches

If you have more directories found than user_watch slots then we’ve found the problem (the table is filling up)

Output:

plex@plex:~$ find /Media -type d -print | wc -l
2585
plex@plex:~$ sudo sysctl fs.inotify.max_user_watches
[sudo] password for plex:
fs.inotify.max_user_watches = 61327

I have no idea what that means, but…

More info. Please ignore if irrelevant.

I did tail -f /var/log/syslog while I added media and received this as soon as I put the folder/file in /Media

2025-03-21T20:17:12.323877+00:00 plex kernel: CIFS: Attempting to mount //192...2/plex
2025-03-24T01:28:46.091884+00:00 plex kernel: CIFS: VFS: Autodisabling the use of server inode numbers on \\192...2\plex
2025-03-24T01:28:46.091897+00:00 plex kernel: CIFS: VFS: The server doesn't seem to support them properly or the files might be on different servers (DFS)
2025-03-24T01:28:46.091898+00:00 plex kernel: CIFS: VFS: Hardlinks will not be recognized on this mount. Consider mounting with the "noserverino" option to silence this message.

If you think this is relevant, I see a possible fix here with adding noauto,x-systemd.automount to fstab

That’s what I expect. CIFS (Microsoft) does not understand/support the concept of an inode. This is Linux only. It therefore is correct for inode (inode number) to be to be disabled when mounting with CIFS.

Another point to also understand is: Files created / modified on a file server do not send any type of notifications to clients (your Plex server) when they are created/modified)

For my use:

  1. I set a timer (every 30 min)
  2. I configure “Partial Scan” (Library - Show Advanced)

On the PMS server, which is also the NAS. this works natively so autodetect works as intended

So, would switching to NFS protocol help?

Any recommendations on the correct parameters for /etc/fstab for NFS mount?

Thanks for your time

Whether using NFS or CIFS, detection isn’t a guarantee.

Inotify service is only within the namespace (confines) of the kernel running PMS.

If you look here:

https://support.plex.tv/articles/201638786-plex-media-server-url-commands/

There are several URLs which you can use curl with to get:

  1. Section list
  2. Section IDs
  3. Tell PMS to start scanning the specific section / directory

With this mechanism, you can have the file server send specific “I updated this …” info to PMS and it will go scan & update appropriately

I have successfully kicked off a manual scan with this:

http://192…:32400/library/sections/1/refresh?X-Plex-Token=!

Now to figure out how to automate this when new media is added.

Thanks again for your time, @ChuckPa – really appreciate the help

Best

If you’re using OTA tools ( *arr ), there is a Connect feature.
With Connect, you can have it run scripts (script sends the appropriate API call)