Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== File Descriptors ====== **General Information** File descriptors (aka file handles) are files that have been opened by processes. There are settings for limiting the amount of files that can be open for the entire system and also per user. **Checklist** * Distro(s): Any ---- ===== System Wide ===== **View system wide file descriptor information** <code bash> sysctl fs.file-nr fs.file-nr = 6144 0 809542 </code> The three numbers returned: * 6144 = used file descriptors * 0 = allocated but not used * 809542 = system max **Change System FD Limits** Edit /etc/sysctl.conf <code bash> fs.file-max = 810542 </code> Example above increases system wide max by 1,000. ---- ===== Per User ===== **View user file descriptor limits** <code bash> su - bill ulimit -Hn 4096 </code> The above asks ulimit to show the hard limit (-H) for the max number of open file descriptors(-n) for user "bill". 4096 was returned. **Change user file descriptor limits** Edit /etc/security/limits.conf <code bash> #<domain> <type> <item> <value> bill soft nofile 4096 bill hard nofile 8192 </code> Save and reboot. ---- ===== File Descriptor Errors in Bash ===== If you see this error while trying to execute a command in bash: <code bash> -bash: fork: retry: Resource temporarily unavailable </code> Then you are hitting a file descriptor limit. **To Fix** Either the system wide limit is being reached or the individual user limit is reached. * Increase one of them or * Determine what processes is opening so many files and kill it. See how many open files a user has <code bash> lsof -u bill 2>/dev/null | wc -l </code> linux_wiki/file_descriptors.txt Last modified: 2019/05/25 23:50(external edit)