0

on our linux rhel servers fs.file-max set with 100000

sysctl -p | grep fs.file-max
fs.file-max = 100000

from my understanding the file-max kernel parameter refers to open file descriptors, and file-nr gives us the current number of open file descriptors. But lsof lists all open files, including files which are not using file descriptors – such as current working directories, memory mapped library files, and executable text files.

so back to my question

dose the following lsof , really good indication that we reached the fs.file-max value?

lsof | wc -l

OR

[[ ` lsof | wc -l ` -gt 100000 ]] && echo "please increase the fs.file-max"
King David
  • 433
  • 4
  • 17

1 Answers1

0

see global current open files:

cat /proc/sys/fs/file-nr

NoNoNo
  • 1,939
  • 14
  • 19
  • so can we do [[ ` cat /proc/sys/fs/file-nr | awk '{print $1}' ` -gt 100000 ]] && echo please increase the fs.file-ma – King David May 05 '20 at 04:47
  • is it really the indication to test if we reached the fs.file-max – King David May 05 '20 at 04:49
  • Here some documentation about it https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/tuning_and_optimizing_red_hat_enterprise_linux_for_oracle_9i_and_10g_databases/chap-oracle_9i_and_10g_tuning_guide-setting_file_handles – NoNoNo May 05 '20 at 04:52
  • yes but this doc not answer on my question - dose [[ ` cat /proc/sys/fs/file-nr | awk '{print $1}' ` -gt 100000 ]] && echo please increase the fs.file-max is really the indication ? – King David May 05 '20 at 04:57