Running more than 4GB RAM on Fedora, RHEL, & CentOS 5

For about a year now, we’ve been happily running two Dell PowerEdge 2950s with quad procs, 4GB of RAM (or so we thought), and RHEL5. Running a high-traffic website can be memory intensive, so we recently decided to upgrade the memory, and bought 8 more GB of RAM for each machine.

But, after installing the new DIMMs, the machines still only showed 4GB RAM available. Hmm… a couple of web searches later, and I learned something new: the 64-bit versions of RHEL and CentOS can see and use 4GB or more of RAM just fine, but if you’re running a standard 32-bit version of RHEL or CentOS, you can only use 4GB… unless you install a special version of the kernel that allows you to see the extra memory. If you’re running at least CentOS 5, RHEL 5, or Fedora 8, you can use a PAE-enabled kernel called kernel-PAE (you can learn more about at Physical Address Extension at Wikipedia). A PAE-kernel will allow you to run up to 64GB of RAM in a 32-bit Linux distro. If you’re running CentOS / RHEL 3 or 4, or an earlier version of Fedora, you may be able to use kernel-hugemem instead. Because I’m running RHEL 5 on these boxes, kernel-PAE would solve my problem.

This discovery brought some some good news – we actually had 8GB installed in each of our servers, but we’d only been using 4GB of it for almost a year! Even better news is that adding PAE support to your 32-bit system to unlock this new memory is very easy with yum:
# yum install kernel-PAE

The output should look something like this:

Loading “installonlyn” plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
–> Populating transaction set with selected packages. Please wait.
—> Downloading header for kernel-PAE to pack into transaction set.
kernel-PAE-2.6.18-164.9.1. 100% |=========================| 207 kB    00:00
—> Package kernel-PAE.i686 0:2.6.18-164.9.1.el5 set to be installed
–> Running transaction check
Dependencies Resolved
Package                 Arch       Version          Repository        Size
kernel-PAE              i686       2.6.18-164.9.1.el5  updates            17 M

Transaction Summary
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 17 M
Is this ok [y/N]: y
Downloading Packages:
(1/1): kernel-PAE-2.6.18- 100% |=========================|  17 MB    00:17
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: kernel-PAE                   ######################### [1/1]

Installed: kernel-PAE.i686 0:2.6.18-164.9.1.el5

Because this is a new kernel, a reboot is required. Type:

# reboot

Once the machine is rebooted and you’re logged in, verify that you’re running the PAE-enabled version of the kernel by typing:

# uname -a

The output should show something like:

Linux hostname 2.6.18-164.9.1.el5PAE #1 SMP Wed Dec 9 03:46:34 EST 2009 i686 i686 i386 GNU/Linux

If, however, you don’t see PAE in the description of the kernel, don’t panic. It most likely means that you simply need to edit your /boot/grub/menu.lst file to make the PAE-enabled kernel boot by default. Edit that file and change the default= value to the new PAE-kernel (it will usually be the first one). For example, if the first kernel in the list is shown as:

title Red Hat Enterprise Linux Server (2.6.18-164.9.1.el5PAE)

Then change the default line to read:

(remember that 0 is the first number, not 1) and then reboot.

Once you’re properly booted with the PAE-enabled kernel, you can verify that the new memory is available by typing:
free -m

Which will display your total and available memory in megabytes. Mine looks like this:

# free -m
total       used       free     shared    buffers     cached
Mem:         16238       4698      11539          0        267       2385
-/+ buffers/cache:       2046      14191
Swap:         8191          0       8191

Again, I’m a little embarassed that I wasted 4GB in each server for nearly a year, but it’s fun to learn new things as a Linux geek, and even more fun to share them so others can learn from my mistakes. 🙂