file-max :
The Linux Operating system kernel allocates file handles dynamically and the value in file-max denotes the maximum number of file handles that the Linux kernel will allocate. When you get a lot of error messages about “running out of file handles” , increasing this limit will help. To change the value, just write the new number into the file as below:
[root@unixfoo root]# cat /proc/sys/fs/file-max
8192
[root@unixfoo root]# echo 943718 > /proc/sys/fs/file-max
[root@unixfoo root]# cat /proc/sys/fs/file-max
943718
[root@unixfoo root]#
8192
[root@unixfoo root]# echo 943718 > /proc/sys/fs/file-max
[root@unixfoo root]# cat /proc/sys/fs/file-max
943718
[root@unixfoo root]#
This value also can be changed using “sysctl” command. To make the change permanent, add the entries to /etc/sysctl.conf
[root@unixfoo root]# cat /etc/sysctl.conf
fs.file-max = 943718
[root@unixfoo root]#
fs.file-max = 943718
[root@unixfoo root]#
file-nr :
The three values in /proc/sys/fs/file-nr denotes the number of allocated file handles, the number of allocated but unused file handles, and the maximum number of file handles. You can monitor this to keep a check on the file handles.
