Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm currently facing a problem on a linux box where as root I have commands returning error because inotify watch limit has been reached.

# tail -f /var/log/messages
[...]
tail: cannot watch '/var/log/messages': No space left on device
# inotifywatch -v /var/log/messages
Establishing watches...
Failed to watch /var/log/messages; upper limit on inotify watches reached!
Please increase the amount of inotify watches allowed per user via '/proc/sys/fs/inotify/max_user_watches'.` 

I googled a bit and every solution I found is to increase the limit with:

sudo sysctl fs.inotify.max_user_watches=<some random high number>

But I was unable to find any information of the consequences of raising that value. I guess the default kernel value was set for a reason but it seems to be inadequate for particular usages. (e.g., when using Dropbox with a large number of folder, or software that monitors a lot of files)

So here are my questions:

  • Is it safe to raise that value and what would be the consequences of a too high value?
  • Is there a way to find out what are the currently set watches and which process set them to be able to determine if the reached limit is not caused by a faulty software?
share|improve this question

1 Answer 1

up vote 24 down vote accepted

Is it safe to raise that value and what would be the consequences of a too high value?

This is from an old link, so might have changed, but the point is, raise it as high as you want:

inotify watch is 40 bytes
inotify device is 68 bytes
inotify event is 272 bytes

Is there a way to find out what are the currently set watches and which process set them to be able to determine if the reached limit is not caused by a faulty software?

I don't expect that there should be a way to find out who changes the value (here referring to "/proc/sys/fs/inotify/max_user_watches"). I guess very few codes need the values higher than the default (~8k). The only one such code I know is Tracker (a desktop indexer, among other things), and it makes such heavy use of the feature that the Debian package sets it to ~64k.

NOTE: If you want the setting to be permanent, set it in "/etc/sysctl.conf". Mine looks like:

fs.inotify.max_user_watches=100000
share|improve this answer
1  
I guess very few codes need the values higher than the default Dropbox may require a higher limit, depending on how many files you have. Iv'e raised mine with no issues. in fact, the dropbox notification (that occurs when it reaches its limit) explicitly tells you to raise it. –  Falmarri May 25 '11 at 20:55
    
Isn't there also a dnotify that works the same, but on directories? Maybe consolidate multiple files you are inotifying into a single directory? –  ultrasawblade Jun 16 '11 at 13:36
    
@ultrasawblade: am not familiar enough with the technology to give you a decent answer –  Tshepang Jun 20 '11 at 8:55
1  
@ultrasawblade- inotify replaced dnotify. dnotify was slow and buggy. inotify can be used on directories, and a directory will be "changed" when one of the files in that directory (one level deep) is modified. Directories are just files anyway. –  tjameson Jul 10 '11 at 5:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.