Linux real-time file watching errors
Linux performs real-time file watching using the inotify API. Inotify imposes a limit on the number of "watches" that can be in use on a system at any given time. If the Code42 agent exceeds inotify's max watch limit, real-time file watching fails to work properly, and some or all file changes are not detected until the Code42 agent's file verification scan runs. This article describes how to increase the max watch limit to avoid this problem.
Code42 agent for Linux
- A "watch" corresponds to one watched file or directory.
- Inotify commonly limits the max watch value to 8192.
- This issue is not related to problems that can arise from the Linux open files limit.
- Some files selected for backup are immediately backed up when changes are made, while others are not.
- After your screen is locked, you are are unable to sign back in to your desktop session.
- Error messages in service.log specify "Unable to add watch for path [filepath], errno: 28," like the following:
WARNING W2108307534_ScanWrkr com.backup42.jna.inotify.InotifyManager.watch ] Unable to add watch for path /var/www/php/common/gen2.save/ext-lib/Dojo/dojox/highlight, errno: 28
Step 1: Find the current watch limit
Find the current inotify watch limit by examining the proc file system. In Terminal, run the following:
Step 2: Change the watch limit
To change the watch limit value, edit the sysctl.conf file.
In this example, 1048576 is being set as the new value. Adjust this number as appropriate for your system.
- Edit /etc/sysctl.conf as root:
sudo nano /etc/sysctl.conf
- Set (or add if it's not present) the
fs.inotify.max_user_watchesparameter. Set this to the desired number of watches:
- Save sysctl.conf and exit.
If you're using nano, press Control+X, followed by Y, then Enter to save the file.
- Either reboot the system or execute the following command:
sudo sysctl -p /etc/sysctl.conf