Increase the number of directories Linux can monitor

As per the instructions here I need to increase the number of directories Linux can monitor.

I’m a bit lost as math is very much not my strong point, and the way this is worded is very confusing.

B. Determine how many directories to actually allocate

Round up to the next multiple of 32768 (32K)

My Plex media folder has 16417 directories. So I round up to 32768.

C. Calculate and verify memory utlization

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.

What does this mean by ‘entries’? It means Directories? There’s no mention of entries prior to this. So if that means Directories I multiply 32768 x 512 = 16777216

So this informs me 16777216 Kernal memory will be permantly used. What does that even mean? By that I mean what is that number in relation to actual hardware memory installed. I have 16GB

Some easy math to do this is: ( (Number_of_active_slots / 32768) + 1 ) * 32768.
Example: (53000 / 32768) => 1 ; 1 + 1 => 2; 2 * 32768 = 65536

253000 / 32768 = 7 (drop the fraction)
7 + 1 = 8
8 * 32768 = 262144

yeah, you lost me completley here. 7+1=8 (That I understand hah , but why is that even in there? That’s rhetorical btw).

So my question:.

I have 16417 directories and 16GB memory. What number should I put into NEW_MAX_DIRECTORIES ??

fs.inotify.max_user_watches=NEW_MAX_DIRECTORIES

Any help appreciated!

Based on B you have correctly determined that you’ll need to set NEW_MAX_DIRECTORIES to 32768.

Section C is about how much memory this will consume… in your case that’ll be approx. 17 MB. That’ll leave more than enough memory for your day-to-day activities.

Therefore… go ahead and set the # of directories to be watched to 32768.

thanks for the clarification, it worked out fine!

How may I improve the wording?

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