Friday, January 8, 2010

Beat the 4GB RAM barrier in 32-bit Linux

In all operating systems, there is a limit to the total amount of system memory that can be addressed. In 32-bit systems, this limit is at 4GB. This is one of the reasons for the current push toward 64-bit operating systems. A 64-bit operating system can support a theoretical 16.3 petabytes of system memory. This maximum amount of system memory includes not only the RAM but also any dedicated video memory on discrete graphics cards. For this reason, many users with 4GB of RAM installed and a video card will see somewhere between 3 and 3.5GB of systems memory instead of their full 4GB that is installed.

In Ubuntu Linux, there are a few ways around this problem. The obvious solution is to switch to the 64-bit version of the operating system. The downside to this approach is that it requires reinstalling the operating system and there may be software compatibility issues. The other way is to install a kernel that supports PAE. In short, PAE is a way to get a 32-bit kernel to support more than 4GB of system memory. In Linux, a PAE enabled kernel is able to use up to 64GB of total system memory.

If your system has 4GB or more of RAM installed and the system isn't reading as all of it being there, you can run this command to install the PAE enabled kernel:
$ sudo aptitude install linux-generic-pae
You will, of course, have to restart in order to use this new kernel. After restarting you can verifying that you are, indeed, using the kernel by running this command:
$ uname -r
You should see a number followed by the string "generic-pae". As of this writing, the most current version is 2.6.31-17-generic-pae. You can also check how much RAM the system can see by using this command:
$ free -m
 This will show you system memory usage, measured in megabytes. The top left number represents the total RAM the system is able to use.

A word of warning, you won't need to install the PAE enabled kernel if you are running Ubuntu server. The server releases are running a server version of the kernel that is optimized differently and already supports PAE.

No comments:

Post a Comment