Using dmidecode to determine physical RAM and processors

From Brandonhutchinson.com

(Difference between revisions)
Jump to: navigation, search
Current revision (03:49, 16 December 2008) (edit) (undo)
 
Line 13: Line 13:
MemTotal: 3368120 kB
MemTotal: 3368120 kB
-
This example RHEL 5 IA-32 system should definitely be using a PAE kernel.
+
This example RHEL 5 IA-32 system should definitely be using a PAE kernel, or using an x86_64 kernel and distribution.
=== Processors ===
=== Processors ===

Current revision

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, or using an x86_64 kernel and distribution.

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