From Swearingen on Tue, 26 Jan 1999
Is there a way that I can tell Linux (Red Hat 5.2) how much RAM my machine has?
Yes.
(The churlish imp in me would love to just leave it at that --- but I supposed you'd actually know HOW to do it).
Your kernel is reponsible for all memory management under Linux. You can pass parameters to your kernel in a number of ways (depending on how you load it). The most likely scenario is that you are using LILO (the LInux LOader). This normally gives a brief prompt, at which you can type in a variety of parameters.
Read the bootparam(7) man page and BootPrompt HOWTO
(http://metalab.unc.edu/LDP/HOWTO/BootPrompt-HOWTO.html)
for details on the range of parameters that can be entered. You can also set environment variables which will be inherited by the init process (and thus by all other processes).
You can type in the mem= parameter there to over-ride the kernel's automatic memory detection and supply your own value. That will just affect one session (useful for testing your system to make sure that it will work with the value that you propose). To make this change persistent you can edit the file /etc/lilo.conf and add a line like:
append="mem=128M"
... note: The "append" directive in the /etc/lilo.conf "appends" a string to the kenrel's command line (invocation) so you can have multiple append directives, and I think you can put multiple parameters within one append= directive (all separated by spaces and enclosed with the one pair of double quote signs). You do need the quote signs and the M (for Megabytes).
I've covered this before. Earlier versions of the Linux kernel couldn't reliably detect memory above 64Mb on some (most?) systems. However, newer Linux kernels (2.0.36 and the new 2.2.0) should detect your full memory capacity automatically.
Of course I'm only guessing at the symptom that you're trying to address. I do know of people who maintain boot images with LESS memory than they have installed. This is usually done by software developers to allow them to test their packages under artificial "low memory" and "swap thrashing" conditions. This can be done exactly as I've described above.
Note: I hope it's obvious that we're talking about real memory (real chips and SIMMs inside your system) here --- and not about "virtual memory" (paging/swap space). The way to increase or disable your swap is to create a swap partition or a swap file (technically its really a "paging" partition or file --- but the term swap is misused throughout the libraries, sources, and documentation).
You can run the command "man -k swap" to learn about the commands and configuration files that relate to swap files and partitions.
If you tell the kernel that your system has more memory than it really has --- you'll almost certainly crash, almost immediately.
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | ||||
11 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | ||||
23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 37 | 38 | ||||
39 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 |