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.
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)
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.
(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.