Swap space in Linux is used when the amount
of physical memory (RAM) is full. If the system needs more memory
resources and the RAM is full, inactive pages in memory are
moved to the swap space. While swap space can help machines with a small
amount of RAM, it should not be considered a replacement for more RAM.
Swap space is located on hard drives, which have a slower access
time than physical memory.
Swap space can be a dedicated swap partition (recommended), a swap file,
or a combination of swap partitions and swap files.
The size of your swap should be equal to twice your computer's physical
RAM for up to 2 GB of physical RAM. For physical RAM above 2 GB, the
size of your swap should be equal to the amount of physical RAM above 2
GB. The size of your swap should never less than 32 MB.
Using this basic formula, a system with 2 GB of physical RAM would
have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB
Unfortunately, deciding on the amount of swap to allocate to Red Hat Enterprise Linux is
more of an art than a science, so hard rules are not possible. Each
system's most used applications should be accounted for when
determining swap size.
File systems and LVM2 volumes assigned as swap space
cannot be in use when being modified. For
example, no system processes can be assigned the swap space, as well
as no amount of swap should be allocated and used by the kernel. Use
the free and cat /proc/swaps
commands to verify how much and where swap is in use.
The best way to achieve swap space modifications is to boot your
system in rescue mode, and then follow the instructions (for each
scenario) in the remainder of this chapter. Refer to Chapter 5 Basic System Recovery for instructions on booting into rescue
mode. When prompted to mount the file system, select