On our Linux RHEL servers fs.file-max
is set to 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.
Is the following lsof
really a good indication that we have reached the fs.file-max
value?
lsof | wc -l
or
[[ `lsof | wc -l` -gt 100000 ]] && echo "please increase the fs.file-max"
other relevant links - How to display open file descriptors but not using lsof command