I'm running Ubuntu 14.04, when trying to sync a directory with unison using the option repeat=watch
. The directory contains ~125K
files but I'm abutting a limit on the number of files unison can handle. This is the error I receive:
Fatal error: Server: Filesystem watcher error: cannot add a watcher: system limit reached.
The watcher can be disabled by setting preference 'watch' to false.
I searched for more information by running unison with debug=all
but these are the only lines I can find related to the error.
Any idea as to what system settings need to be changed to get around this limit?
I'm fairly certain that the problem isn't with Unison, but with
inotify
. When you use the optionrepeat=watch
, Unison calls a helper programunison-fsmonitor
which usesinotify
to watch the filesystem for changes. It puts a "watch" on each file that you are syncing with Unison.By default there is an upper limit on the number of watches a single user can evoke. On my machine that upper limit is only 8192. You can increase the number of watches by editing the file
I would be a bit concerned that since you want to watch about 125k files and the default maximum is only about 8k, you might see a dramatic hit in performance if you increase the maximum by that much.
You can add the line
watch = false
to your unison profile, and it should work, although without the "benefits" of the watcher.