Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a machine with 4gb of RAM, but Linux is only detecting two in top and free. The BIOS reports 4.

Running i386 Debian Lenny.

share|improve this question
add comment

3 Answers 3

up vote 11 down vote accepted

You need to enable the bigmem kernel.

dpkg --get-selections | grep bigmem
apt-get install linux-image-2.6-xxx-bigmem

You can also check to see if it worked with:

sudo grep -i memory /var/log/dmesg
[ 0.004000] Memory: 899224k/917504k available (1693k kernel code, 17724k reserved, 746k data, 320k init, 0k highmem)

highmem should be larger than 0k

share|improve this answer
add comment

You could install a 64-bit version of Debian. This assumes you have a 64 bit processor, which isn't clear from the question. Using the PAE extensions on a 32-bit kernel incurs a performance hit, and without those, you won't be able to see the full 4GB of memory.

share|improve this answer
    
You can "see" thoe 4GB w/o PAE, it's just that one single process can't. But you can have the memory used by a number of processes. –  niXar Jun 14 '09 at 9:53
add comment

(I would have added this as a comment on Mark's answer, but it grew too long to fit)

As Mark points out you won't see the full 4Gb with any 32-bit kernel. Depending on your chipset and other factors you will see between 3.25Gb and 3.75Gb without the performance hit of PAE.

But you don't have to have a full 64 bit system - just a 64-bit kernel. I run a server with 6Gb RAM this way: the kernel sees the whole 6Gb (not 3.5Gb a 32-bit kernel could use on the machine) but has a 32-bit everything else (I haven't found time to do a full re-install to 64-bit yet).

aptitude install linux-image-2.6-amd64

is all you need to do (at least on etch, which this box still is, I doubt the package name has changed in Lenny).

While no individual process will see more then 3Gb RAM (because of the way the virtual memory space is mapped for each process) your processes in total can use the whole lot. In my case the machine runs several VMs which together consume ~5Gb (the host OS using the rest for a few other little things and IO cache/buffers). So if the bigmem kernel can only make use of 3.25Gb of your 4 this might be worth a try to make the extra 0.75 available.

One further caveat: if the machine's chipset is limited to 4Gb then you may still find some of you RAM "missing" even with a 64-bit kernel (or full 64-bit OS install). But I think you'll be unlucky to find a chipset that supports 64-bit processors without supporting >4Gb RAM.

share|improve this answer
    
That's incorrect; you will see the full 4GB. It's just that a single app won't be able to make use of it at once. –  niXar Jun 14 '09 at 9:52
    
I'm not sure it is. By my understanding: with a chipset that won't go beyond 4Gb (note: this is maximum supported by the chipset, which may well be more then the max supported by any given board using that chipset) there is nowhere for the kernel to map the memory that clashes with PCI/AGP windows and similar to even if in 64-bit mode, other than to use PAE like a 32-bit kernel would have too. On a 32-bit kernel - the total available will be less than 4Gb, not just the per-process limit being <4Gb. –  David Spillett Jun 14 '09 at 17:12
    
Anecdotal evidence: I have a 32 bit kernel now and only see a little over 3Gb of RAM (I have 4GB in the machine and a bigmem enabled kernel). The 64 bit kernel with 32 bit userland sounds like it might be the way to go to see the full amount. Time to go tinkering... –  Mark Jun 15 '09 at 14:03
    
That is where I started from. The machine had 4Gb but the kernel could only use ~3.25. It has been running this way (64 bit kernel, 32-bit userland) for nearly six months now and I've not experienced any problems. –  David Spillett Jun 15 '09 at 15:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.