More Deep Discovery on your Linux Server With /proc - page 2
Changing system settings with /proc/sys
Here are a few more interesting variables to experiment with:
- Changing /proc/sys/fs/file-max will change the number of filehandles that are available – this will get rid of error messages stating the maximum number of open files has been reached, and no more files can be opened. The default is 4096, but you can use any number. (It's probably best to change this only if you actually run into this limit.) You can do the same thing for inodes with /proc/sys/fs/inode-max. However, the total number of inodes available overall on the system can't be changed in this way.
- /proc/sys/kernel/ctrl-alt-del allows you to set the response to the Ctrl+Alt+Del key combination. 1 will set this to be a graceful shutdown (like typing shutdown -h now; 0 will be an immediate shutdown (like turning the power off). 1 is probably a safer value (after all, if you really have to do an immediate non-clean shutdown you can always physically turn the power off).
- You can use /proc/sys/kernel/hostname to configure your network hostname -- be careful doing this if you have DHCP as you might create a conflict.
- If experiencing load problems on an NFS server, you can increase the server memory queue limits by changing the value in the rmem_default, rmem_max, wmem_default, and wmem_max files in /proc/sys/net/core/. Try 262144 (256K) as a starting point. I've found this very useful with NFS servers in the past.
If you poke around in /proc/sys/, there's plenty of other files you can play around with. Basically, if a file has the write attribute set, then you can change it – but do course be aware that you could potentially screw up your system by doing this! The good news is that changes made in this way will only last until the next boot; to make changes permanent, use sysctl and /etc/sysctl.conf instead. Type sysctl -a | less to look at a list of parameters. Working directly with the /proc/sys/ settings is a useful way to experiment before making permanent changes with sysctl or other tools.
As with the process directories, there's a lot of information in /proc/ and I haven't covered all of it here. Spend some time having a poke through /proc with the man page to find out what else is there and what you might be able to change. Unfortunately the proc documentation can be a bit lacking in some cases. If the man page is unhelpful, try the docs in /usr/src/linux/Documentation/ (you may need to install kernel source packages), or at kernel.org. Alternatively, go take a look through /proc and then Google for whatever file or directory names you find.
Have fun exploring the limits of your system!
- 1Linux Top 3: Fedora 24, Peppermint 7 and Solus 1.2
- 2Linux Top 3: Alpine Linux 3.4, deepin 15.2 and Linux Lite 3.0
- 3Linux 4.7 Set to Boost Live Patching, Security and Power Management
- 4Linux 4.6 Charred Weasel adds USB 3.1 Support
- 5Linux Top 3: OpenIndiana 2016.04, Ubuntu 16.04 and Debian's New Leader