Increasing the Linux directory limit.
Very simple integer math
- Determine the total number of directories in use (from top to bottom)
sudo find /dir1 /dir2 /dir3 (as many as needed here) -type d -print | wc -l
- This results in a number. Add 32767 to that number
- Divide by 32768 (modular units)
- Add 1 (allocate another 32K )
- Multiply back out for the iNotify value
- Add to /etc/sysctl.conf
Looks like
[chuck@lizum /vie.258]$ find ./movie* ./tv* ./*music* ./*ani* ./uhd ./4k -type d -print | wc -l
16313
[chuck@lizum /vie.259]$ expr 16313 + 32767
49080
[chuck@lizum /vie.260]$ expr 49080 / 32768
1
[chuck@lizum /vie.261]$ expr 1 + 1
2
[chuck@lizum /vie.262]$ expr 2 \* 32768
65536
[chuck@lizum /vie.263]$ sudo sh
sh-4.4# echo fs.inotify.max_user_watches=65536 >> /etc/sysctl.conf
sh-4.4# sysctl -p
fs.inotify.max_user_watches = 65536
sh-4.4#