/proc/kcore
This file represents the physical memory of the system and is stored in the core file format. Unlike most /proc/ files, kcore displays a size. This value is given in bytes and is equal to the size of the physical memory (RAM) used plus 4 KB.
The contents of this file are designed to be examined by a debugger, such as gdb, and is not human readable.
$ ls -l /proc/kcore
-r——– 1 root root 267243520 May 26 06:14 /proc/kcore
Creating a Swap File
At a shell prompt as root, type the following command with count being equal to the desired block size:
64 MB swap file is 65536
dd if=/dev/zero of=/swap bs=1024 count=65536
Setup the swap file with the command:
To enable the swap file immediately but not automatically at boot time:
To extend an LVM2 swap logical volume (assuming LogVol01 is the volume you want to extend):
1.Disable swapping for the associated logical volume:
2.Resize the LVM2 logical volume by 500 MB:
# lvm lvresize LogVol01 -L +500M
3.Format the new swap space:
4.Enable swap on the extended logical volume:
Changing Virtual Files
As a general rule, most virtual files within the /proc/ directory are read-only. However, some can be used to adjust settings in the kernel. This is especially true for files in the /proc/sys/ subdirectory.
To change the value of a virtual file, use the echo command and a greater than symbol (>) to redirect the new value to the file. For example, to change the hostname on the fly, type:
echo www.serverbuddies.com > /proc/sys/kernel/hostname
Other files act as binary or Boolean switches. Typing cat /proc/sys/net/ipv4/ip_forward returns either a 0 or a 1. A 0 indicates that the kernel is not forwarding network packets. Using the echo command to change the value of the ip_forward file to 1 immediately turns packet forwarding on.
Using the sysctl Command
he /sbin/sysctl command is used to view, set, and automate kernel settings in the /proc/sys/ directory.
For a quick overview of all settings configurable in the /proc/sys/ directory, type:
The sysctl command can be used in place of echo to assign values to writable files in the /proc/sys/ directory. For example, instead of using the command
echo 1 > /proc/sys/kernel/sysrq
Use the equivalent sysctl command as follows:
sysctl -w kernel.sysrq=”1″
kernel.sysrq = 1