Sunday, December 30, 2007

Beyond 4GB on 32-bit Systems

Those of you lucky enough to Get 4GB (or more) of RAM surely suffer from the DRN syndrome: Dumb RAM Number Syndrome. This is when Windows reports that the amount of available RAM is 3.25GB instead of 4GB, which is due to the fact that either your hardware can't support that much of memory capacity, or your OS hasn't been configured/tricked into reading high capacities.

Operating Systems Supported

Regardless of whether you have 32-bit or 64-bit hardware, if your Operating System (OS) is 32-bit, then you can't address more than 4GB, unless you enable a certain option in the OS. Before jumping into configurations, below is a list of 32-bit Operating Systems:
  • Linux 2.4/2.6 kernel
  • Windows 2000/XP/2003/Vista

Linux Specific:
The wiki article (referenced below) is wrong; It states that 4GB can't be addressed unless when 2.6 kernel is used. This is not true, and here's an excerpt from my 2.4 kernel help:

If you are compiling a kernel which will never run on a machine with more than 960 megabytes of total physical RAM, answer "off" here (default choice and suitable for most users).
...
If the machine has between 1 and 4 Gigabytes physical RAM, then answer "4GB" here.
If more than 4 Gigabytes is used then answer "64GB" here.


That can be found under "Processor type and features" -> "High Memory Support".
* You need PAE support only if you have more than 4GB, if you have 4GB or less, you don't need PAE.
On a 2.6 kernel, the support for 4GB RAM or more is automatically enabled, as far as I know.


Windows Specific:
PAE support is not enabled by default on compatible hardware, so you have to do it yourself.
First check whether your hardware is supported or not, then follow the steps to enable PAE.

Hardware Support

To be able to configure the OS to see 4GB or more, you need hardware support from the processor.

Windows users skip this step and go to the section where PAE is setup. If that doesn't work, come back and read this section.

Instead of boggling your head and going on a Googling frenzy try to figure out whether your processor has that ability or not, the easiest way is to download a Linux LiveCD (192MB), which will basically run Linux OS from the CD, without touching your hard disk. After you download the ISO file, use a CD burning utility to burn the ISO file CD image to a CD (don't copy the ISO file to the CD!). Then put the fresh CD into the CD-bay and reboot your computer (make sure the CD boot order is before the hard disk -- check your BIOS setup options). Once the CD boots, you'll get a black screen with some text here 'n there, type the user as root, and the password as toor. Then execute the command:
grep "pae" /proc/cpuinfo

You will get an output like this:
flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm

As you can see, pae is among the clutter, which means that your processor supports having 4GB or more.

* If the LiveCD doesn't boot, it's most likely that you have crappy old hardware, so don't bother reading the rest of this post!

PAE

I guess you're sick of seeing this PAE word over & over & over & over & ... Well, PAE means Physical Address Extension (PAE).
Hoping that you still a few working brain-cells, after banging your forehead for not figuring that out sooner, below are the steps to enable PAE on Linux & Windows.

Linux:
- For 2.4 kernels, you need to recompile your kernel. (If you don't know to do so, visit LinuxQuestions.org and read the forums).
Make sure to specify the proper option in "Processor type and features" -> "High Memory Support": 4GB for machines with 1-4GB of RAM, and 64GB for machines with more than 4GB of RAM.

- For 2.6 kernels, as far as I know, 2.6.18+ should have that option enabled by default to handle 1-4GB or more. If you can prove otherwise, please let me know.

Windows:
- XP/2003: Right click "My Computer" -> "Properties" -> "Advanced" -> Startup section "Settings" -> "Edit" -> Add "/PAE" without the quotes at the end of the last line (not the blank line!) -> Save the file and close it -> OK all the way & reboot.

- Vista: I have no clue, as I have no access to a vista machine, but a decent Google query should do it. (Something like: windows vista PAE how)

If you had done the configurations above and Windows stopped booting for you, this probably means that you don't have PAE support. You can undo your evil trick, by booting into "Safe Mode" and removing "/PAE" and rebooting again.
To be sure whether your processor supports PAE or not, read the hardware section at the top. All of it!

Testimonials

You don't see this often, but I'm going to take my own testimony! I tried the above with a Windows machine running on a 64-bit XEON (EM64T) processor with Windows 2003 Standard installed. After enabling the PAE switch, the server was able to see all 6GB of RAM installed, where it saw 3.25GB only before.

I'll be buying 8GB of RAM soon for my home machine, and I'll update this post on the results.

References & links:
http://kerneltrap.org/node/2450
http://en.wikipedia.org/wiki/Physical_Address_Extension
http://www.microsoft.com/whdc/system/platform/server/PAE/PAEdrv.mspx

No comments: