Using dmidecode to determine physical RAM and processors

From Brandonhutchinson.com

(Difference between revisions)
Jump to: navigation, search
(New page: === Physical memory === Situation: On an IA-32 (i386) Linux system without a PAE kernel, how can you be sure that the correct amount of physical memory is being returned by the kernel? Wi...)
Line 1: Line 1:
=== Physical memory ===
=== Physical memory ===
-
Situation: On an IA-32 (i386) Linux system without a PAE kernel, how can you be sure that the correct amount of physical memory is being returned by the kernel? Without a PAE kernel, the system will report a maximum of 4GB physical memory.
+
Situation: On an IA-32 (i386) Linux system without a PAE kernel, how can you be sure that the correct amount of physical memory is being returned by the kernel? Without a PAE kernel, the system will report a maximum of 4GB physical memory. Note that this does not apply to x86_64 kernels, as they can address more than 4GB physical memory.
The easiest way I know of to determine the amount of physical memory in a Linux system is using '''dmidecode'''. The following works on RHEL 3, 4, and 5:
The easiest way I know of to determine the amount of physical memory in a Linux system is using '''dmidecode'''. The following works on RHEL 3, 4, and 5:

Revision as of 03:48, 16 December 2008

Physical memory

Situation: On an IA-32 (i386) Linux system without a PAE kernel, how can you be sure that the correct amount of physical memory is being returned by the kernel? Without a PAE kernel, the system will report a maximum of 4GB physical memory. Note that this does not apply to x86_64 kernels, as they can address more than 4GB physical memory.

The easiest way I know of to determine the amount of physical memory in a Linux system is using dmidecode. The following works on RHEL 3, 4, and 5:

# dmidecode | perl -ne '$memory += $1 if /^\t+Size: (\d+)/ ; END { print "$memory\n" }'
8192

How much memory is being reported by the kernel?

# head -1 /proc/meminfo
MemTotal:      3368120 kB

This example RHEL 5 IA-32 system should definitely be using a PAE kernel.

Processors

Similarly, dmidecode may also be used to tell you the number of physical processors in a system. If you are running a uniprocessor kernel, the kernel will report one CPU regardless of how many you have.

It is very unlikely that you would be running a non-SMP kernel with multiple physical processors, but here's a way to return the actual number of physical processors in on a uniprocessor kernel. The following works on RHEL 2.1, 3, 4, and 5 (note that all kernels are SMP-enabled on RHEL 5):

# dmidecode | perl -ne '$num_procs += 1 if /^\t+Type: Central Processor/ ; END { print "$num_procs\n"}'
2

Links

Get Information About Your BIOS / Server Hardware From a Shell Without Opening Chassis ( BIOS Decoder )]

Personal tools