How to increase Inotify Watches Limit on a Linux server

How to increase Inotify Watches Limit on a Linux server

 
Default Inotify Watches Limit value on most of the servers will be 8192. You can check the current Inotify Watches Limit value if you have server root access. Log into your linux server via SSH as ‘root’ user.

Type the command “cat /proc/sys/fs/inotify/max_user_watches” to check the current Inotify Watches Limit

Example :

cat /proc/sys/fs/inotify/max_user_watches
8192

Do the below steps to increase Inotify Watches Limit. Do not set this value too high because this will consume memory.

Take a backup of the file /proc/sys/fs/inotify/max_user_watches using cp command

cp -a /proc/sys/fs/inotify/max_user_watches /usr/local/src/max_user_watches.bakk

Run the below command after taking backup of the file

echo 14000 > /proc/sys/fs/inotify/max_user_watches

You can make the changes permanent by editing the file “/etc/sysctl.conf”. Open the file /etc/sysctl.conf using vi editor and add the below line in it.

fs.inotify.max_user_watches=16384

Don’t forget to run the command “sysctl -p” for changes to take effect.