Swap Space; What Is Swap Space; Adding Swap Space - Red Hat ENTERPRISE LINUX 4 System Administration Manual

Hide thumbs Also See for ENTERPRISE LINUX 4:
Table of Contents

Advertisement

Chapter 11.

Swap Space

11.1. What is Swap Space?

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 be 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 of swap.
Note
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.
Important
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
Chapter 5, Basic System Recovery
to
prompted to mount the file system, select Skip.

11.2. Adding Swap Space

Sometimes it is necessary to add more swap space after installation. For example, you may upgrade
the amount of RAM in your system from 128 MB to 256 MB, but there is only 256 MB of swap space.
It might be advantageous to increase the amount of swap space to 512 MB if you perform memory-
intense operations or run applications that require a large amount of memory.
You have three options: create a new swap partition, create a new swap file, or extend swap on an
existing LVM2 logical volume. It is recommended that you extend an existing logical volume.
for instructions on booting into rescue mode. When
103

Advertisement

Table of Contents
loading

Table of Contents