Using All Available RAM

Q: Using All the Memory

My computer has 128 MB of RAM, but I'm not sure all of it is being used. How can I find out whether all the RAM is being used? Is there a way to get Linux to recognize all my memory, if it isn't already?

A: Instruct the Kernel to Use All Your RAM

Usually, the Linux kernel will recognize all of the RAM on a system; however, there may be circumstances in which not all of the memory is being recognized.

There are a couple ways to make certain that all of your machine's memory is being used by the Linux kernel. First, you can test to see if it's being used and, if it isn't, you can either enter the option at the boot: prompt or you can edit a file called /etc/lilo.conf to make sure that the memory is used each time you boot into your system. (The /etc/lilo.conf is the configuration file for LILO, the LInux LOader.)

First, open an Xterm window and, at the shell prompt, type cat /proc/meminfo to find out the current statistics about memory usage on your system. Your output will probably look similar to the following:

        total:    used:    free:  shared: buffers:  cached:
Mem:  64655360 63033344  1622016 51159040  1552384 33816576
Swap: 73990144   700416 73289728
MemTotal:     63140 kB
MemFree:       1584 kB
MemShared:    49960 kB
Buffers:       1516 kB
Cached:       33024 kB
SwapTotal:    72256 kB
SwapFree:     71572 kB
	  

Among the categories you'll find will be the total amount of memory the Linux kernel "sees" (Mem:). If, for example, you have 128 MB of RAM, and you see the Mem entry reporting only 64 MB or so, then you can instruct the kernel to use all the RAM on your system.

You can pass the instruction to the kernel at the LILO boot: prompt by typing it in, such as

boot: linux mem=128M
		

Once you press Enter, you'll boot with your new memory options. If you don't want to type the option each time you boot, you can enter the option in /etc/lilo.conf. You can use the editor called Pico.

But first, you'll have to su to root. In an Xterm, type

[you@localhost you]$ su
password: yourrootpassword
[root@localhost you]#
		

Now, to edit /etc/lilo.conf, in the same Xterm window, type

[root@localhost you]# pico /etc/lilo.conf
		

The file will probably look similar to the following:

boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
image=/boot/vmlinuz-2.2.5-15
        label=linux
        root=/dev/hda1
        read-only
	  

In this file, place the following as the first line: append="mem=128M". With the addition, then, the file should look something like this:

append="mem=128M"
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
image=/boot/vmlinuz-2.2.5-15
        label=linux
        root=/dev/hda1
        read-only
	  

You can use the Ctrl-X to quit the file.

You'll be asked if you want to save the file; select Y to save your changes, N if you don't want to save the changes, and Ctrl-C to cancel.

Now, type /sbin/lilo at the prompt to restart LILO. You can type exit to leave root, and type exit again to close the window.

When you reboot, your memory configuration will be passed to the kernel.