If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

Increase the number of directories Linux can monitor (Notify)

ChuckPAChuckPA Posts: 22,199Members, Plex Pass, Plex Ninja, Plex Team Member Plex Team Member
edited October 2017 in Linux Tips

The default size of the Linux iNotify table is 8192 directories. When PMS is configured to update automatically when media is added, with properly organized media, especially music, this table rapidly fills and exceeds the default allocation.

The solution to this is straight forward. Increasing the table size is easy. The first step is to determine how many directories to allocate,

A. Determine how many directories are currently in use:

sudo find /dir1 /dir2 /dir3 -type d -print | wc -l (use your actual directory names and not dir1, dir2, or dir3. You may add as many top level directories as you need)

B. Determine how many directories to actually allocate

Round up to the next multiple of 32768 (32K). This is done to maximize memory page alignment and keep the maximum amount of memory available for hardware transcoding (if used). This number is called NEW_MAX_DIRECTORIES in the example below.

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. If this results in more memory allocated than you are comfortable allocating, a decision must be made to a) Add more memory to the system or b) reduce the number of directories PMS can automatically monitor. In most cases, increasing system memory is more desirable and yields better overall performance.

D. Implement the change
With calculations complete, it is time to implement the configuration change.


sudo sh
echo  fs.inotify.max_user_watches=NEW_MAX_DIRECTORIES  >> /etc/sysctl.conf
sysctl -p

Example: Allocate 256K (262144) directory entries for the iNotify table

sudo sh
echo  fs.inotify.max_user_watches=262144  >> /etc/sysctl.conf
sysctl -p

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

sysctl was then invoked to make the change immediate (-p).
The system can also be rebooted to make the change take effect.

Please DISABLE Verbose logging until requested

Please search before posting

Primary support: Linux, Synology, and QNAP

Please remember to report back. This benefits others.

Useful links

 Installation and Basic Setup |  Media Preparation (How to name your media files)  |  Linux Permissions 

 Handling TV Specials | Handling Movie extras  |  Nas Compatibility

 Reporting Plex Server issues | Plex Media Server FAQ | Linux Tips


Other useful guides: Local Subtitles | The Plex "dance" | Synology FAQ | PMS Release Announcements

Hosts: Fedora, QNAP, Synology, most Linux distros in VM

No technical support via PM unless offered

Please remember to mark the appropriate answer(s) which solved your issue.

This discussion has been closed.