"How do I increase the inotify limit to get my filesystem watcher to work?"

Hey! New user here, and I’m seeing:

Failed to start filesystem watcher for folder yourLabel (yourID): failed to set up inotify handler. Please increase inotify limits, see https://docs.syncthing.net/users/faq.html#inotify-limits

which from searching this forum seems to be a common site.

I’m a little confused though, because I only have 4 folders.

number of watches per user (usually 8192)

Is it 1 folder = 1 watch? Is it 1 file = 1 watch? How can one find out what the current restriction is?

(Meta: can I add this info to the docs?)

Also, I think (but I’m not sure, how would I know? I refreshed the web-ui and nothing changed, I had to manually re-scan to see new files) that echo 204800 | sudo tee /proc/sys/fs/inotify/max_user_watches didn’t do anything for me, is there a typo in that line, or does that only work for certain systems?

The docs are open source, anyone can submit contributions to it through GitHub: GitHub - syncthing/docs: Documentation site

The docs mean actual filesystem folders, not “syncthing-folders”. The kernel’s inotify system allows a process to watch for events (file changes) on individual files or directories. However, the latter is not recursive so if I have the following directory structure:

example
├── 1
│   └── foobar.txt
├── 2
│   └── myfile.png
└── 3
    └── other_data.bin

4 directories, 3 files

Then that’s 4 watches: Syncthing watches the top-level folder “example” to see if any new folders or files are added at the same level as 1,2,3, but it also watches folders 1, 2 and 3 individually to check if files and folders are added/removed/changed within them.

The current per-user limit should be in the (virtual) file cat /proc/sys/fs/inotify/max_user_watches. If you change the limit, it will take a moment to become effective. Syncthing needs to retry setting up the watches, so either rescan all folders or restart syncthing entirely. Refreshing the GUI does absolutely nothing for syncthing.

Thank you @Nummer378!

With what you’ve told me, I’m a bit confused as to why I saw the warnings.

I think this status panel is showing me that I have 124 watches. Nowhere near 8192…

I ran curl -s https://raw.githubusercontent.com/fatso83/dotfiles/master/utils/scripts/inotify-consumers | bash from here, to see what else was using watches…

   INOTIFY   INSTANCES
   WATCHES      PER   
    COUNT     PROCESS   PID USER         COMMAND
------------------------------------------------------------
  181260         1      548474 danny       /usr/bin/proton-drive-sync start --no-daemon
   22869         1      390492 danny       /home/danny/.dropbox-dist/dropbox-lnx.x86_64-242.4
     142         1        8498 danny       /usr/bin/syncthing serve --no-browser --logfile=de
...

… and I see that this is not just a system that syncthing uses! That explains it.

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