Return to General UNIX Home Page.
The /proc Filesystem
by Jeff Hunter, Sr. Database Administrator
One of the ways in determining what is going on inside the UNIX kernel is to make use of the /proc filesystem. Some of that information may be disk arrays connected to your server or querying kernel parameters. The /proc filesystem offers an interface to important kernel data structures that provide information about the state of a running UNIX kernel by use of special files. The System Administrators uses the UNIX cat command to list the contents of those special files.
Under Linux, it is also possible to set certain kernel parameters by using the echo command. For example, to change the kernel parameter value used to control the maximum socket receive buffer size, net.core.rmem_default, to 262144, use the following:
# echo 262144 > /proc/sys/net/core/rmem_default
It is important to understand when setting kernel parameters in Linux using the echo command, (as in the above example), these settings need to be applied each time the system boots. Some distributions of Linux already have a setup method for this during boot. On Red Hat, this can be configured in /etc/sysctl.conf: (like: net.core.rmem_default = 262144).
This article attempts to list some of the more common files used by System Administrators. Although most of these special files are general enough to apply to all flavors or UNIX (Solaris, Linux, HP-UX, etc.), I indicate those that only apply to a particular platform.
Current Amount of Installed RAM Memory - (Linux, FreeBSD)
Used to determine the amount of installed RAM memory on Linux. This file is read-only.
# cat /proc/meminfo | grep MemTotal MemTotal: 513928 kB
Current State of RAID Devices - (Linux, FreeBSD)
The first query indicates that support for linear, RAID0, RAID1, and RAID5 is compiled into the kernel, but currently has no active arrays. The second example of one active RAID-1 array with two member disks (/dev/sdc1 and /dev/sdb1) and one spare disk (/dev/sdd1). This file is read-only.
# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid5] read_ahead not set unused devices: <none> # cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid5] read_ahead 1024 sectors md0: active raid1 sdd1 adci sdb1 17920384 blocks [2/2] [UU] unused devices: <none>
Files Limit - (Linux, FreeBSD)
On database servers, it is important to ensure the files limit is set high enough. If you need to increase this value, for example, to 65536 if for some reason it shows a value less than 65536:
# cat /proc/sys/fs/file-max 52224 # echo "65535" > /proc/sys/fs/file-max # cat /proc/sys/fs/file-max 65535
SCSI Device - (Linux, FreeBSD)
The following can check for a SCSI device
# cat /proc/scsi/scsi Attached devices: Host: scsi0 Channel: 00 Id: 00 Lun: 00 Vendor: MegaRAID Model: LD0 RAID1 8568R Rev: 1.01 Type: Direct-Access ANSI SCSI revision: 02 Host: scsi0 Channel: 00 Id: 01 Lun: 00 Vendor: MegaRAID Model: LD1 RAID0 04034R Rev: 1.01 Type: Direct-Access ANSI SCSI revision: 02 Host: scsi0 Channel: 04 Id: 06 Lun: 00 Vendor: DELL Model: 2x2 U2W SCSI BP Rev: 1.16 Type: Processor ANSI SCSI revision: 02 Host: scsi0 Channel: 05 Id: 06 Lun: 00 Vendor: DELL Model: 2x3 U2W SCSI BP Rev: 1.16 Type: Processor ANSI SCSI revision: 02
Networking Parameters - (Linux, FreeBSD)
The following parameters are used to view and set Networking Parameters under Linux
The default setting (in bytes) of the socket receive buffer
# cat /proc/sys/net/core/rmem_default 65535The maximum socket receive buffer size (in bytes)
# cat /proc/sys/net/core/rmem_max 131071The default setting (in bytes) of the socket send buffer
# cat /proc/sys/net/core/wmem_default 65535The maximum socket send buffer size (in bytes)
# cat /proc/sys/net/core/wmem_max 131071