I’ve had some trouble lately with the inotify watches and I kept forgetting how to set them. Unfortunately it seems like I was always using a temporary method, which got reset after a restart, so I’m writing this to remember me how to use both the temporary and permanent modes.
First of all, you should know that an active inotify watch uses 540 bytes of memory on a 32-bit system and 1KB on a 64-bit system, so make sure not to use too many. You can set the max to be very high and it won’t use your memory unless they are active.
How to check the number of max inotify watches
The easiest way of doing it is a simple command:
How to increase the max number of inotify watches temporarily
You can use a very easy command to increase them temporarily, but they will get reset after a reboot.
You can also edit the
/proc/sys/fs/inotify/max_user_watches file manually and add the number to the file. Nothing else is needed, except the number. So the file contents should look like
How to increase the max number of inotify watches permanently
In order to increase their number permanently, you will have to edit
/etc/sysctl.conf and add the following code:
1 thought on “How to increase the max number of inotify watches on Debian/Ubuntu”
How do we find how much memory used for current running inotify watches?