"Run a partial scan when changes are detected" - not working anymore

Server Version#: 1.19.4.2935

Just noticed that I have to trigger library scan manually. Someone having the same problem?

Yes. On my end it has been happening for a few months (with all newest Plex Pass versions installed). Currently running Version 1.19.4.2935 (Ubuntu 18.04 Dockerized) as well. My “Movies” and “Music” libraries appear to be adding and scanning upon being added. My “TV Shows” seems to be the only library I have to manually trigger a scan for.

Partial scan has nothing to do with Plex Pass or PMS version on Linux.
It has everything to do with the number of directories being monitored.
The Linux kernel default maximum is 8192 directories.
Properly structured media, especially music, will consume that directory table quickly.

The remedy is simple. Please consider:

Good to know, but my number is 547 directories only. In Plex at least. Do I have to summarize all monitored directories of the whole server, even if Plex is running in a docker container? :thinking:

Would you please do the following:

  1. Verify DEBUG logging is enabled.
  2. Verify VERBOSE logging is disabled.
  3. SAVE if you made changes to these.
  4. Restart PMS
  5. Wait 2 minutes for PMS to come to full ready (allow to remain quiescent for the duration).
  6. Download the Logs ZIP file
  7. Attach the ZIP in your next reply (drag, drop, allow to upload)

I’ll see what it’s not liking.

Thanks!
There are some error messages saying like

ERROR - [Notify] Failed to add watch for “…” (28: No space left on device)

Is that what we are looking for? However, there is lots of space available. Plex is just having no write access to my media directory. Read only. But I don’t think that is the problem, is it?

Plex Media Server Logs_2020-06-24_19-47-48.zip (719.1 KB)

That message occurs when you do have more than 8192 (default) directories being indexed.

Perhaps you should use my find command sequence as I detailed in the how-to.
You may have 547 top level directories but how many sub directories do you have?

please show me the console output from the file, inclusive of the find command itself.

It is also possible, albeit very rare, you are almost out of physical memory.

Can you give an example of the math used to determine the amount or RAM dedicated to the scanner using the directory count method?

“Multiply the number of entries from above by 512 (worst case size of an inode entry). This tells you how much kernel memory will be permanently allocated and not available to other applications such as PMS.”

“In the above example, the table was configured for 262144 (256K) directories on a system with 8GB of main memory.”

So how much memory is claimed for the 256k directories? The math of 262144 * 512 = 134,217,728. This doesn’t (in my mind) make sense to GB of RAM usage. I just want to know with the increase of directories monitored in the example, how much RAM is dedicated to the scanner?

Thanks!

if you have 256K, as in ~262144 directories, at 512 bytes each, you get a table size of 134 MB of RAM used. You have 8192 MB (8GB) of ram.

This 134 MB is dedicated (internal) to the kernel but used exclusively by the Plex scanner.

what does free -m show now?

Damn, wasn’t expecting such a quick response. Thanks.

I’m running with 16GB RAM, and even with multiple transcodes going (plus other dockers, etc) only at max using 8GB. I wont have a chance to implement the change until late tonight when all users are asleep. I did the math via 512 bytes and had the same number. I thought I must be wrong. I didn’t fathom that the usage or RAM would be so low. Just wanted to make sure before I dedicated RAM and possibly had too much dedicated.

My total directory count is only around 50k (Movies, Music, TV Shows, Audiobooks, etc). So will probably test at the 65536 mark and see if it improves.

But again thanks for the quick response!

Implementing this change can be done live.
It will take effect at the next PMS restart or when you disable/re-enable automatic detection. The choice is yours.

  1. add the new value to /etc/sysctl.conf
  2. sudo sysctl -p (force the kernel table to resize)
  3. Turn off auto detection
  4. Enable auto detection.
  5. Magic should happen immediately
    :slight_smile:

Ah, I didn’t catch that part previously. (I’m at work and just skimmed the article you linked). I’ll implement change immediately and see what ends up happening tonight as more shows are grabbed and added automatically.

Thanks!

A quick scan of your logs will verify it’s picking up all the directories.
You should see no more “No space left” errors.

Ok, change implemented.

Quick question, do you think my two problems could be related (& changing the number of watched directories might be the fix)?? Or are they likely separate and unrelated events?

https://forums.plex.tv/t/metadata-not-working-incomplete/590452/71

Anyway, thanks for your input. I will report back within the next day or so to say if that fixed the issue at hand or not.

I would need look but metadata is very dependent on naming and any embedded title/name info.

In regards towards naming convention, I use sonarr for pulling tv shows. I have it set to rename (which hasnt ever posed an issue). Movies (despite embedded tags – which are an entirely different issue) all work fine. Just wondered if the lack of being able to monitor all the directories might also cause an issue on pulling metadata. (Didn’t mean to hijack the thread). So if unrelated, ok. If related, neat.

I’ve not written code in a VERY LONG time, so I didn’t know if the possible backends were related or even tied together in some form/fashion/way…

That is what I did. But as I said before, there are other services running on that Server monitoring their directories. So it seems it’s adding up, even though Plex is running in a docker container. You live and learn…

Update… Items added to my first TV Shows drive (ChuckPa will know) are doing autodetection/autoscan and add. Items on other ‘TV Shows’ drives are not being seen/detected/added without use of a manual scan. (Caveat: Metadata is still not pulling in for either newly added TV/Movies – detected automatically or manually scanned…)

With the latest update to PMS and changing the number of watched directories to a more fail-safe number, it is finally accurately detecting the addition of items (TV/Movies/Music) properly and scanning/adding it.

I did have to set up each of my machines (PMS machine, and nzb machine) with NTP so I could ensure matching time stamps (ie: no machine present files in the future). [Major thanks to ChuckPa for that one!]

(All of my machines are Ubuntu 18.04LTS running all programs via docker)

Another side-note that ChuckPa pointed out (wasn’t my issue, but might be with others), NAS will not autoscan. My drives are local to the machine that PMS is on, but others might have the issue if they are networked vs local.

(Also metadata is now pulling in correctly again with the implementation of these changes and the newest update of PMS)

The only issue I’m still having – which is unrelated – is music scan. Auto/Manual scan. It keeps getting hung on certain albums. Takes forever to push past those and finish the scan. No other scans will happen until the music scan has completed, as they are in queue. If its something (TV/Movie) I need added immediately I will normally just take down the docker container of PMS and bring it back up and manually scan TV, Movie, Music in that order so it does eventually finish scanning and adding music to the dB.

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