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: Make the Kernel 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 is more than one way to make certain that all of your machine's memory is being used by the Linux kernel. First, test to see if all of your RAM is being used. If it is not, you can either enter an option at the boot: prompt every time you boot your machine or you can edit /etc/lilo.conf. If you edit /etc/lilo.conf, you will not have to add any options at boot time.

To see if the Linux kernel recognizes all of the RAM on your machine, at a 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 see will be the total amount of memory the Linux kernel recognizes (in the Mem: field). If, for example, you have 128 MB of RAM, and you see the Mem: entry reporting only 64 MB or so, then you should instruct the kernel to use all the RAM on your system.

You can pass the instruction to the kernel at the LILO boot: prompt. Reboot your system (if you boot directly to X, you will need to press [Ctrl]-[x] when prompted). At the boot: prompt, type the amount of memory your system should recognize, for example:

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.

su to root and use Pico or your favorite text editor to edit /etc/lilo.conf. In /etc/lilo.conf, you'll see 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

Type in the following text as the first line: append="mem=128M". With the addition, 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. To exit the root account, type exit.

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