Use / proc file system to control system date: August 13 @ 23:27:22 CST Article topic: Integrated Technology
Detailed introduction to the usage and the exact information of each file in / proc beyond the ranges involved herein. To get any other information about the / proc file that is not involved in this article, a best source is that the Linux kernel source code itself, which contains some very good documents. For system administrators, the following files in / proc are useful. This doesn't mean it is a detailed description, but is just a reference in everyday use.
/ Proc / SCSI / PROC / SCSI / SCSI as a system administrator, the most useful content that needs to be understood is that more disk space can be added to how to add more disk space without restarting the system in the case of a heat exchange drive. If you don't use / proc, you can insert the drive, but in order to identify the new disk, you must re-boot the system. Here, you can use the following command to identify the new drive:
Echo "SCSI Add-Single-Device W x Y Z"> / Proc / SCSI / SCSI
In order for this command to run normally, you must specify the correct parameter value W, Y, Y, X, Y, Y, as follows: W is the host adapter identifier, the first adapter is zero (0) x is the SCSI channel on the host adapter, One channel is zero (0) Y is the SCSI identity Z is the LUN number, the first LUN is zero (0)
Once the disk is added to the system, any file system that is previously formatted can be hung, or it can begin formatting it. For example, if you do not determine which device is device, or want to check any previously existing partitions, you can use commands such as fdisk -l to report this information.
Conversely, the command removed from the system without rebooting the system:
Echo "SCSI REMOVE-SINGLE-Device W x Y Z"> / Proc / SCSI / SCSI
Before entering this command and removes the heat exchange SCSI disk from the system, make sure you first remove any file system that has been installed from the disk.
/ Proc / Sys / FS // Proc / Sys / FS / File-Max This file specifies the maximum number of file handles that can be assigned. If the user gets the error message declares that since the number of open files has reached the maximum, they cannot open more files, they may need to increase this value. This value can be set to have any multiple files and can change this value by writing a new digital value to the file.
Default setting: 4096
/ proc / sys / fs / file-nr This file is related to file-max, it has three values: the maximum number of file handles of the number of file handles has been used. The file is read-only, only for Display information.
/ proc / sys / fs / inode- * Any operation performed by a file starting with the name "Inode" is the same as the operation performed on the name of the name "file", but the operation performed is related to the index node. And independent of the file handle.
/ proc / sys / fs / overflowuid and / proc / sys / fs / overflowgid These two files saves the user ID (UID) and Group ID (GID) of any file system that supports 16-bit user ID and group identity. These values can be changed, but if you really feel that you need this, you may find that the change group and password file item are easier.
Default setting: 65534
/ Proc / Sys / FS / Super-Max This file specifies the maximum number of hyper block handlers. Any file system that is hung needs to use a super block, so if a large number of file systems are hung, you may use the super block handler. Default setting: 256
/ Proc / Sys / FS / SUPER-NR This file displays the number of currently allocated hyper blocks. This file is read-only and is only used to display information.
/ proc / sys / kernel / proc / sys / kernel / acct This file has three configurable values, depending on the number of available spaces on the file system containing the log, these values are controlled when the value is started to perform process accounting: If the available space is lower than this percentage, stop process accounting If the available space is higher than this percentage value, the start process account checks the frequency (in seconds) of the above two values to change a certain value of this file. A string of numbers separated by spaces should be returned.
Default setting: 2 4 30
If only less than 2% free space is included in a file system containing logs, these values will stop the billing, if there are 4% or more free space, start the bill again. Take a check every 30 seconds.
/ proc / sys / kernel / ctrl-alt-del This file has a binary value that reacts when receiving the Ctrl Alt Delete button combination. These two values indicate that zero (0) value indicates capture Ctrl Alt Delete and send it to the init program. This will allow the system to close and restart perfectly, just like you enter the shutdown command.壹 (1) value means that Ctrl Alt Delete will not capture, will perform non-clean off, just close the power directly.
Default setting: 0
/ proc / sys / kernel / domainname This file allows you to configure network domain names. It has no default, perhaps the domain name has been set, maybe there is no setting.
/ proc / sys / kernel / hostname This file allows you to configure the network hostname. It does not have a default, may have set a host name, and may not be set.
/ proc / sys / kernel / msgmax This file specifies the maximum length of messages sent from one process to another. The message delivery between the processes is performed in the memory of the kernel. It is not swapped onto the disk, so if this value is added, the amount of memory used is added.
Default setting: 8192
/ proc / sys / kernel / msgmnb This file specifies the maximum number of bytes in a message queue.
Default setting: 16384
/ proc / sys / kernel / msgmni This file specifies the maximum number of message queue identifiers.
Default setting: 16
/ proc / sys / kernel / PANIC This file indicates that if the kernel PANIC is happened, the kernel waits for time (in seconds) before rebooting. Zero (0) Second Settings will prohibit reboot when the kernel is seriously incorrect.
Default setting: 0
/ Proc / Sys / Kernel / Printk This file has four numeric values, which defines where it is sent according to the importance of logging messages. For more information on different log levels, please read the Syslog (2) Online Help page. The four values of the file are: Console Log Level: Messages above this value will be printed to the console default message log level: the priority will be used to print the minimum message without priority messages Log Level: The console log level can be set for the minimum (highest priority) default console log level: the default value of the console log level
Default setting: 6 4 1 7 / proc / sys / kernel / shmall This file is the total amount of shared memory (in bytes) that can be used on any given time system.
Default setting: 2097152
/ proc / sys / kernel / shmax This file specifies the size of the maximum shared memory segment allowed by the kernel (in bytes).
Default setting: 33554432
/ Proc / Sys / Kernel / SHMMNI This file represents the maximum number of shared memory segments throughout the system.
Default setting: 4096
/ proc / sys / kernel / sysrq If the value specified by the file is non-zero, activate the System Request Key.
Default setting: 0
/ Proc / Sys / Kernel / Threads-Max This file specifies the maximum number of threads that the kernel can use.
Default setting: 2048
/ proc / sys / net / proc / sys / net / core / message_burst Write the time required for the new warning message (in 1/10 seconds); other warning messages received during this time will be discarded. This is used to prevent certain attempts from "drowning" Denial of Service) of your system.
Default setting: 50 (5 seconds)
/ proc / sys / net / core / message_cost This file has a cost value associated with each warning message. The larger the value, the more you want to ignore the warning message.
Default setting: 5
/ proc / sys / net / core / netdev_max_backlog This file is specified, and the rate of receiving the packet at the interface is faster than the rate of the kernel, allowing the maximum number of packets to the queue.
Default setting: 300
/ proc / sys / net / core / optMEM_MAX This file specifies the size of the maximum buffer allowed for each socket.
/ Proc / Sys / Net / Core / RMEM_DEFAULT This file specifies the default value (in bytes) of the receiving socket buffer size.
/ proc / sys / net / core / rmem_max This file specifies the maximum value of the receiving socket buffer size (in bytes).
/ Proc / Sys / Net / Core / WMEM_DEFAULT This file specifies the default value of the send socket buffer size (in bytes).
/ proc / sys / net / core / wmem_max This file specifies the maximum value of the transmit socket buffer size (in bytes).
/ Proc / Sys / Net / IPv4 All IPv4 and IPv6 parameters are recorded in the kernel source code document. See File /usr/src/linux/documentation/neetworking/ip-sysctl.txt.
/ Proc / Sys / Net / IPv6 with IPv4.
/ Proc / Sys / VM / Proc / Sys / VM / BUFFERMEM This file controls the number of entire system memory for buffer memory (represented by percentage). It has three values that set these three values by writing a series of numbers separated by spaces. The minimum percentage of memory for the buffer is not much in memory, and the system memory is reducing this, the system will attempt to maintain the number of buffer memory. Maximum percentage of memory for buffer
Default setting: 2 10 60
/ Proc / Sys / VM / FREEPAGES How to deal with all levels of available memory. It has three values that set these three values by writing a series of numbers separated by spaces. If the number of available pages in the system reaches the minimum, only the kernel is allowed to assign some memory. If the number of available pages available in the system is lower than this limit, the kernel will be swapped in a relatively active manner to release memory, thereby maintaining system performance. The kernel will try to keep this quantity of system memory available. The kernel exchange will be started below this value. Default setting: 512 768 1024
/ Proc / Sys / VM / KSWAPD This file control allows the kernel to exchange memory. It has three values that set these three values by writing a string of numbers separated by spaces: the number of kernel tested a maximum number of pages released at a time. If you want to increase the bandwidth during the memory switch, you need to add this value. The core attempts to release the minimum number of pages in each switch. The number of kernels written in a swap. This has the greatest impact on system performance. The greater this value, the more data exchanged, the less the time spent on the disk. However, this value will affect system performance due to the "drowning" request queue.
Default setting: 512 32 8
/ proc / sys / vm / pagecrache This file is the same as the work content of / proc / sys / vm / buffermem, but it is a memory mapping and general cache for files.
Make kernel settings have persistent here to provide a convenient utility for changing any core parameters in / proc / sys directory. It allows you to change the kernel in the run (similar to the Echo and redirection method used above), but it also has a configuration file that is executed when the system boot. This allows you to change the kernel in the run and add these changes to the configuration file to facilitate these changes to take effect after the system reboots.
This utility is called SysctL, in the online help page of SysctL (8), the utility has a complete document description. Sysctl's profile is /etc/sysctl.conf, you can edit the file and record this file under sysctl.conf (8). Sysctl will consider the files under / proc / sys as a single variable that can be changed. Therefore, in / file-max as an example, it indicates the maximum number of file handles allowed in the system, which is represented as FS.FILE-MAX.
This example reveals some wonderful things in the sysctl representation. Since SysctL can only change the variables in / proc / sys directory, and people always think that variables are in this directory, thus omitting the portion of the variable name (/ proc / sys). Another change to explain is that the directory separator (forward slash /) is replaced with the sentence (point.).
Two simple rules in converting files in / proc / sys in sysctl: Remove the front section / proc / sys. Change the front slave in the file name.
These two rules enable you to convert any file names in / proc / sys into any variable name in SYSCTL. The general file to the variable is converted to:
/ proc / sys / dir / file -> dir.filedir1.dir2.file -> / proc / sys / dir1 / dir2 / file
You can use the command sysctl -a to see all variables that can be changed and their current settings.
Use sysctl to change variables, which work is exactly the same as the ECHO method used above. Its representation is:
Sysctl -w dir.file = "value"
Or use File-Max as an example, use one of the following two methods to change the value to 16384:
Sysctl -w fs.file-max = "16384" or:
Echo "16384"> / Proc / Sys / FS / File-Max
Don't forget that sysctl will not add what changes to the configuration file; this will be done by manual. If you want to be re-boot, the changes you have made are still valid, and this configuration file must be maintained.
Note: Not all distributions provide SYSCTL support. If your specific system belongs to this, you can add these commands to the startup script with the ECHO and redirecting methods described above, so that the system will execute them each time you boot.
Commands for setting the system change other non-kernel system parameters while the system is run, and these settings are possible without rebooting the system. This approach is possible. Files containing these parameters are listed in the /etc/init.d directory, which is primarily classified by service, daemons, and servers. Since more and more scripts can be listed in this directory, it is impossible to discuss all various configurations. However, some examples are listed below, discuss how to operate the scripts under /etc/init.d on different Linux distributions. The example here may be useful, discussed to change the daemon, then reload the configuration without rebooting the system: Change the web server configuration, then reload the Apache to remove unwanted inetd login service operation network settings via NFS Export new file system boot / stop firewall
First, a common method is to operate the system service directly through the script in /etc/init.d. These scripts use parameters to operate the services; you can view what valid options can be viewed by entering the script but without any parameters. Common parameters are: Start: Start the stopped service Stop: Stop the running service RESTART: Stop the running service, then restart the service; it will start the stopped service Reload: without interruption any connection , Reload the service configuration status: Report service is running, or stopped
For example, the following command will reload the xinetd configuration without terminating any connected user sessions (if you change /etc/xinetd.conf, then this command is useful):
/etc/init.d/xinetd reload
Red Hat provides service, which can be a service for you. The function provided by the service command is the same as the input feet. Its syntax is as follows:
Service script-name [parameter]
E.g:
Service Xinetd Reload
SUSE also provides a command called RC. This command is similar to the above service command, but there is no space between the command and the script name. Its syntax is as follows:
RC {script-name} parameter
E.g:
Rcapache Start