Help File Library: Where Is The RAM?
Written By:
Tcrompton
The purpose of this document is to help you get Linux to recognize all of
your RAM. It tries to be as complete as possible, covering all the
questions and answers posted on LNO about this problem.
First, some background information; the problem isn't with Linux, it's
with your motherboard's BIOS. Some BIOSes cannot properly report memory
over 64 MB, so this information must be provided before the kernel is
loaded into memory. This is done by passing this info as a boot time
argument, so the reliability of the system does not depend on a flaky BIOS
report.
I know what you're thinking, "Flaky BIOS? But Windows detects all of my
memory just fine. What's the deal?".
(Note: The following is a simplified explanation of the problem based on
the responses to my question in the Kernel Developers mailing list.
Interested reader are encouraged to read the full
post.)
Originally the BIOS had only one function to report the amount of RAM
available, which did not report amounts greater then 64 MB. Later, a
second function was added which fixed this problem. Kernel versions 2.2
and greater support this function. Later still, a new PC standard
introduced a third function, which performed the same duties as functions
one and two. But information on this function was not released to the
general public for over a year, therefore Linux couldn't use it. During
which, Windows developers had the details of this function and used it in
95/NT. And since this third function performs the same duties as the
second function, many BIOS manufactures dropped the second function
altogether.
Thereby creating this problem for you, the Linux user.
"Will kernel 2.4 fix this problem?"
There is a patch to 2.4 which will fix the problem, but it's inclusion
into the kernel source tree has not been agreed upon (as of April 2000).
It's doubtful that the solution will be "back ported" to 2.2, since it
relies on some 2.4 functionality.
"Ok, how do I fix it?"
If you use LILO (the LInux LOader), boot time arguments can be entered at
the boot prompt:
E.g.
boot: linux mem=96M
If you're using LOADLIN, the "mem=" boot argument can be added to the end
of the LOADLIN command.
E.g.
C:\>\LOADLIN\LOADLIN bzImage /dev/hda1 ro mem=96M
You should use the amount of memory that you actually have (mem=128M or
mem=196M, etc.). If you use more then you have, Linux will freeze when
booting up.
If it does freeze and you're sure that you specified the correct amount
of memory, try specifying less, in 1 or 2 megabyte increments.
E.g. use
mem=95M instead of mem=96M
Also, some BIOSes have a feature to create a "Memory Hole at Address
14MB-16MB or 15MB-16MB". Try disabling this feature unless you need it to
support one of your ISA cards.
If it still doesn't work, try upgrading your BIOS. Use
http://www.windrivers.com/company.htm
to search for your motherboard. Some people have also reported success in
switching to an older BIOS version then the one currently installed
(because these BIOSes support the old second function).
This is an important test, and if Linux freezes then just reboot.
If the Linux successfully booted, at the Linux command prompt, type
[you@localhost you]$ cat /proc/meminfo
to check your memory. Your output will probably look like the following:
total:
used: free: shared: buffers: cached:
Mem: 97865728 95547392 2318336 35315712 3588096 27623424
Swap: 136208384 40484864 95723520
MemTotal: 95572 kB
MemFree: 2264 kB
MemShared: 34488 kB
Buffers: 3504 kB
Cached: 26976 kB
BigTotal: 0 kB
BigFree: 0 kB
SwapTotal: 133016 kB
SwapFree: 93480 kB
The important part is "Mem total", which says I have 97865728 bytes. Which
means the boot time argument worked.
The next section deals with configuring LILO. Before continuing, I
recommend
you create a boot
disk.
Now, we can tell LILO to use this argument all the time by using the
"append" option.
E.g.
append="mem=96M"
This option must be placed in the right spot in the "/etc/lilo.conf" file,
the configuration file for LILO. The right spot is the first line of the
that file. Since "/etc/lilo.conf" is owned by root, you need to edit that
file as root.
Here's an example "lilo.conf" file:
append="mem=96M" # <- tells the kernel how much memory it has
boot=/dev/hda1
map=/boot/map
install=/boot/boot.b
prompt
timeout=0
image=/boot/vmlinuz
label=linux
root=/dev/hda7
read-only
If you already using the "append" option, add the "mem=96M" option at the
beginning of it.
E.g.
append="mem=96M hdd=ide-scsi" # <- tells the kernel how much
memory it has
# and reports that hdd is a scsi device.
boot=/dev/hda1
map=/boot/map
install=/boot/boot.b
prompt
timeout=0
image=/boot/vmlinuz
label=linux
root=/dev/hda7
read-only
Now, after you've finished editing "/etc/lilo.conf", you need to run
"/sbin/lilo"
to make sure that your changes are committed. This too, has to be executed
as root.
[you@localhost you]$ /sbin/lilo -v
That's it, enjoy your "new found" RAM :)
References
The
Linux-Kernel Archive
The
Linux
BootPrompt-HowTo
Red
Hat Linux 6.1 Getting Started Guide
Gene's Random Unix Notes
LOADLIN User
Guide
The
Brief Linux FAQ
Credits (in Alphabetical Order)
Richard B. Johnson (root@chaos.analogin.com)
Nathan Zook (nzook@bga.com)
and others.
If you have any more additional questions concerning this problem that are
not covered by this document, consider posting them to JustLinux before sending
them to me. You'll probably get a quicker response.
If you have any suggestion to improve the completeness, readability, or
clarity of this document, please send them to me.