increase the inotify limit (Linux)- a hack

I have some huge folders I sync, increase the inotify limit warning gives a link https://docs.syncthing.net/users/faq.html#inotify-limits suggesting I to do this:

echo “fs.inotify.max_user_watches=204800” | sudo tee -a /etc/sysctl.conf

echo 204800 | sudo tee /proc/sys/fs/inotify/max_user_watches

It did not work so I doubled the 204800 it suggests. It works

echo “fs.inotify.max_user_watches=409600” | sudo tee -a /etc/sysctl.conf

echo 409600 | sudo tee /proc/sys/fs/inotify/max_user_watches

done it a few times now, thought it might help some others

1 Like

this morning I deployed another machine/node: ~1,900,000 files ~250,000 folders ~3.45 TB total

got the exact same inotify limit warning

same solution worked again.

I shut the machine down, and rebooted. same inotify limit warning

after running both commands the error did not return.

Well… In my case (Samsung S9 → openSuse 15.2, vanilla 5.14.13) with 448 files, 4 directories ~5,4GiB even using 409600 did not resolve it.

$ sysctl fs.inotify fs.inotify.max_queued_events = 16384 fs.inotify.max_user_instances = 128 fs.inotify.max_user_watches = 409600

I also applied: $ sysctl -w net.core.rmem_max=2500000

It’s looking like this is a Bug… somebody should flag it as such

The number of watches required depends on the number of things to watch. The docs can make a recommendation but in the end it boils down to being your own environment so you need to use whatever values are appropriate there.

4 Likes

no changes exept update to version 1.18.4 and kernel 5.15.1 and it was gone.

One machine still throws that error message up on reboot.

now instead of Every sync folder, it is just one.

just for testing )and watching on a separate machine)… on that sync folder only, rescan interval changed, default is 3600… went to 20, it does sync as expected.

then I reset the interval and waited, it did sync as expected, but slower. manual rescan and it happened in moments.

so, perhaps if we just ignore the inode error warning it will just work — but slower.

yes, it is annoying. whatever