This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature: System Administration

Got more than a gig of RAM and 32-bit Linux? Here's how to use it

By Bruce Byfield on September 21, 2007 (4:00:00 PM)

Share    Print    Comments   

Nowadays, many machines are running with 2-4 gigabytes of RAM, and their owners are discovering a problem: When they run 32-bit GNU/Linux distributions, their extra RAM is not being used. Fortunately, correcting the problem is only a matter of installing or building a kernel with a few specific parameters enabled or disabled.

The problem exists because 32-bit Linux kernels are designed to access only 1GB of RAM by default. The workaround for this limitation is vaguely reminiscent of the virtual memory solution once used by DOS, with a high memory area of virtual memory being constantly mapped to physical addresses. This high memory can be enabled for up to 4GB by one kernel parameter, or up to 64GB on a Pentium Pro or higher processor with another parameter. However, since these parameters have not been needed on most machines until recently, the standard kernels in many distributions have not enabled them.

Increasingly, many distributions are enabling high memory for 4GB. Ubuntu default kernels have been enabling this process at least since version 6.10, and so have Fedora 7's. By contrast, Debian's default 486 kernels do not. Few distros, if any, enable 64GB by default.

To check whether your kernel is configured to use all your RAM, enter the command free -m. This command gives you the total amount of unused RAM on your system, as well as the size of your swap file, in megabytes. If the total memory is 885, then no high memory is enabled on your system (the rest of the first gigabyte is reserved by the kernel for its own purposes). Similarly, if the result shows over 1 gigabyte but less than 4GB when you know you have more, then the 4GB parameter is enabled, but not the 64GB one. In either case, you will need to add a new kernel to take full advantage of your RAM.

On some distributions, you can add a generic kernel that meets your requirement in a matter of moments. In Debian, for instance, use the apt-cache search command to locate a recent linux-image package for a kernel for a 686 processor if you want support for up to 4 gigabytes. If you want support for up to 64 gigabytes, look for a kernel that ends with 686-bigmem. These kernels will enable support for 64GB. Unfortunately, a generic kernel for only 4GB does not exist. Similarly, in Ubuntu, look for a recent kernel image whose package name ends in smp; these kernels are designed for dual core processors, but work on single core processors as well, although sometimes with a small performance hit.

If your distribution does not include a useful generic kernel, or if you want to fine-tune the use of high memory on your system, you need to compile a custom kernel. You should consult your distribution's documentation for the details of where to get the source code and headers and any unique aspects of compiling a kernel for it. However, enabling high memory support involves no more than five parameters in the Firmware Drivers section:

  • Make sure that CONFIG_NOHIGHMEM is not set.
  • Set either CONFIG_HIGHMEM4G or CONFIG_HIGHMEM64G to yes, using whichever one is appropriate for the RAM in your system. If you have Note that you should use the 4 gigabyte parameter for less than 4 gigabytes of RAM, and the 64 gigabyte parameter for 4 or more gigabytes (4 gigabytes of RAM, remember is actually slightly more than that).
  • Set CONFIG_HIGHMEM to yes.
  • Optionally, set CONFIG_DEBUG_HIGHMEM to yes if you want to log error messages. Since many generic kernels turn this option off, you can probably do without it, especially if you do not delete other kernels from your boot manager's menu, so that you can still start your computer if your newly compiled kernel is unusable.

Compile the rest of the kernel as you choose and install it in your boot manager's menu. Consult the documentation for your boot manager for the details of how to do this.

The next time you start your system, run free -m again. This time, the results should reflect the actual amount of RAM installed. In the few cases that it does not, add a parameter to your boot manager to specify the amount of memory on the system. For both GRUB and LILO, the parameter is mem=<amount of RAM>M, placed just after the name of the customized kernel. The amount of RAM should be in megabytes.

Eventually, this problem will disappear as either high memory kernels become the norm in distributions or the transition to 64-bit Linux is finally complete. However, for the next year or so, this solution is likely to remain useful for anyone perplexed by the apparent lack of RAM on their system.

Bruce Byfield is a computer journalist who writes regularly for Linux.com.

Share    Print    Comments   

Comments

on Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Note: Comments are owned by the poster. We are not responsible for their content.

Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: Anonymous [ip: 84.167.209.136] on September 21, 2007 04:53 PM
You don't need a -bigmem Kernel in Debian if you want to use more than 885Mb RAM:
$ free -m
total used free shared buffers cached
Mem: 1265 847 418 0 67 382
-/+ buffers/cache: 396 868
Swap: 2047 0 2047

$ aptitude search linux-image | grep '^i'
i linux-image-2.6-686 - Linux 2.6 image on PPro/Celeron/PII/PIII/P
i linux-image-2.6.18-4-686 - Linux 2.6.18 image on PPro/Celeron/PII/PII
i linux-image-2.6.20.1 - Linux kernel binary image for version 2.6.
i linux-image-2.6.22-1-686 - Linux 2.6.22 image on PPro/Celeron/PII/PII
i A linux-image-2.6.22-2-686 - Linux 2.6.22 image on PPro/Celeron/PII/PII

$ uname -r
2.6.22-2-686

So what?

#

Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: Anonymous [ip: 192.168.1.144] on September 21, 2007 06:10 PM
The "default" Debian kernels support 4Gb RAM on the -686, -k7, -amd64 etc. variants. If you're still running a -486 kernel, then it won't support >1Gb RAM, but then neither did 486 computers.

#

Re: Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: nanday on September 21, 2007 06:24 PM
Thanks for the correction. I'll revise the article accordingly.

#

Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: Anonymous [ip: 67.93.222.40] on September 21, 2007 06:14 PM
the kernels in etch and on have 4GB support except for the -486 versions , check the config in /boot/config-$(uname -r) to see for yourself

#

Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: Anonymous [ip: 192.168.1.144] on September 21, 2007 06:20 PM
Hmm, are comments on this site which are critical of the article being deleted now?

#

Re: Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: Anonymous [ip: 218.19.199.227] on December 14, 2007 03:47 AM
I don't think so.

<a href="http://www.add2directory.com">Directory Submission Service</a>

<a href="http://www.forexcycle.com">Forex Forecast</a>

#

Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: Anonymous [ip: 213.237.86.210] on September 21, 2007 06:48 PM
SuSE 10.2 reporting 1011 on a 1 Gb system...

#

Re: Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: nanday on September 21, 2007 06:55 PM
My guess would be that SuSE 10.2 has enabled one of the high memory switches. Could you check and confirm?

- Bruce Byfield (nanday)

#

Re(1): Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: Bruce Ferrell on September 23, 2007 01:35 AM
2.6.18.8-0.5 on 10.2 has the 4G switch set. Just for fun I checked an old SuSE8.0. it too has the 4G switch set

#

Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: Anonymous [ip: 87.127.154.18] on September 22, 2007 04:08 AM
Since you are mentioning other distros, the default pclinuxos 2007 kernel, old that it is supports 4gig:

i686 32bit linux kernel (4GB)
The kernel package contains the Linux 2.6.18.8.tex5 kernel, the core of your
PCLinux operating system. It is optimised for the i686 cpu arch and supports up to
and including 4GB of system memory (via highmem). It defaults to using the 'CFQ'
scheduler, 'smp' support enabled and is compiled with kernel preemption disabled.

There are lots of other kernels available.

#

Re: Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: beely on September 22, 2007 04:52 AM
I'm using SuSE 10.0 with 2 GB RAM in Dell Inspiron 5150 laptop - everything recognized right away.
# free -m reports:
total used free shared buffers cached
Mem: 2027 930 1096 0 77 576
-/+ buffers/cache: 276 1750
Swap: 517 0 517

#

wow, just wow :P

Posted by: Anonymous [ip: 69.60.241.238] on September 22, 2007 05:04 AM
lol, guy is a BIT too new for this;) well its ok hes using a nooby ass distro called PCLinuxOS, AAAHAA, he'll learn;)

give him Debian Sid... HE'LL LEARN slowly ;) :P

#

pity the Ubuntu fanbois

Posted by: Anonymous [ip: 75.116.181.98] on September 22, 2007 05:33 PM
PCLinuxOS just bumped their distro from the #1 spot on DistroWatch.



Your mom just called you for lunch. Why don't you go eat at the kitchen table for a change?

#

Re: pity the Ubuntu fanbois

Posted by: Anonymous [ip: 85.186.183.249] on September 26, 2007 12:01 AM
And this is important because... ?
Or is it just your way of saying "my d*ck is longer" ?

#

Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: Anonymous [ip: 85.92.172.28] on September 22, 2007 09:10 AM
If you have less than 4GB, the kernel is intelligent enough to access it. The 4GB patch enables 3GB or more to be accessed by your system but sacrifices 1GB to do so. The 64GB patch sacrifices 4GB to enable access to more than 63GB.

#

PAE and NX-Bit

Posted by: Anonymous [ip: 84.157.228.74] on September 23, 2007 10:19 AM
Interesting is PAE and non-executable memory (required CONFIG_HIGHMEM64G).
So CONFIG_HIGHMEM64G is interesting for user with less than 4GB.
http://en.wikipedia.org/wiki/Physical_Address_Extension
http://en.wikipedia.org/wiki/NX_bit

#

Didn't Mandrake's "enterprise" kernel do this years ago?

Posted by: Anonymous [ip: 75.23.121.191] on September 24, 2007 03:37 AM
Now it's still news in 2007?

#

Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: Anonymous [ip: 124.186.138.17] on September 24, 2007 03:58 AM
thanks

#

well just don't use those broken distros :]

Posted by: Anonymous [ip: 192.168.1.166] on September 24, 2007 09:04 AM
If anyone's still shipping kernel that broken out-of-box (debian i486 is ok since there's i686 as pointed out), the distro's just asking for kernel trouble anyways. I'd not use/recommend that, seeing how our kernel maintainers do consider options and make choices.

For the record (since everyone seems to have either missed or not mentioned that) -- PAE isn't working on both Pentium (The First), a bunch of clones, and more notably 400-MHz FSB Centrinos. So it's not really an option of the day to stick PAE in by default -- at least in 2007.

-- Michael Shigorin

#

Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: Anonymous [ip: 82.146.251.29] on September 24, 2007 12:44 PM
Thanks for another very interesting article Bruce. Keep up the good work. Regards
<a href="http://www.profesjonalna-reklama.pl" target="_blank">Pozycjonowanie</a>

#

64GB How

Posted by: Anonymous [ip: 65.240.236.65] on September 24, 2007 08:17 PM
Can anyone explain to me how is it that you are able to access 64GB of memory in a 32bit processor, doesn't that surpasses the 32bit memory address limit...

#

Re: 64GB How

Posted by: gus3 on September 25, 2007 05:51 AM
(The following applies only to Intel x86-compatible CPU's.)



"32 bits" refers to the word size, the largest directly-addressable width for the accumulator (EAX). The other general registers (EBX, ECX, and EDX) follow suit. In order to get this much data at once, the data bus should be 32 bits wide. However, this is distinct from memory addressing, which uses a segment:offset scheme to facilitate process separation.



There are at least three active segments: code (CS), data (DS), and stack (SS). In the "old days," the segment register was merely multiplied by 16 and added to the offset, meaning the address bus needed to be 20 bits wide (1 megabyte).



Beginning with the 80286, the new "protected mode" meant that the segment register pointed to a selector, which described a segment in terms of "where does it start" and "how far does it go." A segment could still be only 65,536 bytes long, but its origin could be anywhere from byte 0 to (16M - 1). In order to access this much memory, the address bus needed to be 24 bits wide.



In the 80386, this segment origin was extended to 32 bits, allowing a full 4G of directly-addressable memory, and the allowed segment length was also extended to 4G. Note that one could create a segment starting at 4G - 1 byte, and 4G long, so the segment + offset scheme would wrap around the 4G limit. It was up to the software to keep this from happening, or deal with it properly if it did happen.



In the Pentium Pro and later, the address bus was widened to 36 bits, giving 64G of addressable memory. Segments are still a maximum of 4G long, but their origins can go clear up to 64G-1. Conceivably, one could create 16 segments, all 4G long, without any of them overlapping.



None of this has to do with paging, which deals with turning virtual addresses into physical addresses. That's a separate discussion.



For a decent overview of segmentation in the 32-bit Intel CPU's, look at http://en.wikipedia.org/wiki/Protected_mode .

#

Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: Anonymous [ip: 217.200.200.57] on September 24, 2007 10:33 PM
bah.. it's an obsolete article. Everyone knows that linux kernel addresses 4Gb of RAM and if you want more you have to enable the support

#

Sorry, but I must say BS

Posted by: Anonymous [ip: 85.186.183.249] on September 25, 2007 11:59 PM
Almost ANY actual linux distribution (hell, even older ones) is capable of using 4G. The only real limitation that exists is that a single process can not use more than 2 (or lately 3) G of ram at a time.
I don't know how you actually came up with all this stuff, but it's really useless and you are only sending people on wrong paths. Hell, you don't need to recompile any kernel in order to be able to use up to 4G ram on 32 bit platforms.

#

not BS

Posted by: gus3 on September 26, 2007 04:36 AM
As I indicated in an earlier comment, the maximum segment length is still 4G, but the segment base (on Pentium Pro and later) can go anywhere from byte 0 to (64G-1). What's more, a single process can map several such segments, so the actual accessible memory for a single process can reach 64G (minus kernel space).

#

Re: not BS

Posted by: Anonymous [ip: 83.166.201.241] on September 26, 2007 09:42 AM
1). memory over 4G on IA32 is usually found just on big servers - where special kernels are already running;
2). 4G is something, 1G is something else. Any actual distro can use over 1G (the premise of this article) with no difficulty.
3). As an additional indication, the cited article on kerneltrap is a few years old. The problem is long time gone by now.

#

Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: Anonymous [ip: 195.182.195.3] on October 03, 2007 04:42 PM
<a href="http://sandlot.sandlotgames.com/discus/messages/2516/350z-body-kit-5491.html">350z body kit</a> | <a href="http://sandlot.sandlotgames.com/discus/messages/2516/Camaro-body-kit-5492.html">Camaro body kit</a> | <a href="http://sandlot.sandlotgames.com/discus/messages/2516/Cavalier-body-kit-5493.html">Cavalier body kit</a> | <a href="http://sandlot.sandlotgames.com/discus/messages/2516/Ford-contour-body-kit-5494.html">Ford contour body kit </a> | <a href="http://sandlot.sandlotgames.com/discus/messages/2516/Honda-civic-body-kit-5495.html">Honda civic body kit</a> | <a href="http://sandlot.sandlotgames.com/discus/messages/2516/Mustang-body-kit-5496.html">Mustang body kit</a> | <a href="http://sandlot.sandlotgames.com/discus/messages/2516/Scion-tc-body-kit-5497.html">Scion tc body kit</a>

#

Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: Anonymous [ip: 89.61.253.45] on October 09, 2007 10:21 AM
Thank you for the Info, i wanted to change to Linux but if it cant handle 2 GBs of RAM its not so good... anyway i need to read more about it <a href="http://www.yellobook.eu">yellowpages</a>

#

Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: Anonymous [ip: 88.241.119.105] on November 17, 2007 12:12 AM
anyone needs help? add me to msn: destek@sayfa.net i know the solution and its just 5 steps. dont kill yourself :)

#

Got more than a gig of RAM and 32-bit Linux? Here's how to use it

Posted by: Lizunoff on December 18, 2007 07:47 PM
Спамеры херовы:):)

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya