A RAM is important in determining the performance spectrum of your Linux-powered machine. On the other hand, think of a RAM slot as the main memory socket or slot that physically exists on the computer’s motherboard to hold installed/inserted and compatible RAM.
These RAM slots determine/specify the number and type of RAM compatible with the Linux-powered machine you are using. SDRAM (Synchronous DRAM), DDR (Double Data Rate), and DIMM (Dual In-Line Memory Module) are examples of some common RAM types. It is the computer motherboard that determines the existing number of RAM slots.
Therefore, when the term RAM is mentioned, we should always think of RAM modules and RAM slots. Each RAM slot is compatible with a specific RAM module. Examples of popular RAM modules include DDR1, DDR2, DDR3, DDR4, and SDRAM.
RAM Slots Rule of Thumb
When previewing the hardware specs of the machines we want to use or purchase for our Linux projects, we often overlook the need to assess the number of RAM slots installed on the computer keyboard.
Knowing the number of Ram slots available and the ones in use is an important piece of information when it comes to upgrading your machine with new RAM modules (in case there is an empty RAM slot).
Also, the RAM slot to RAM module compatibility info helps determine the type of motherboard you are using and whether it is advisable to upgrade to a new machine with the latest hardware features.
Finding Number of Ram Slots in Linux
This article will walk us through determining available and usable RAM slots in Linux using the following approaches.
1. Using dmidecode Command
As per its manual page, dmidecode is DMI (Desktop Management Interface) table decoder. In short, this tool translates and outputs the table of content regarding your Linux hardware environment info in a human-readable format.
What we expect to find from the retrieved computer environment info includes system hardware components descriptions in addition to BIOS revision and serial numbers info.
The synopsis associated with the usage of the dmidecode tool is as follows:
$ sudo dmidecode [OPTIONS]
We can modify the above dmidecode command syntax to retrieve the info regarding the number of RAM slots in use in our Linux machine in the following manner:
$ sudo dmidecode -t memory
As per the above output associated with the Physical Memory Array, the last entry that reads Number of Devices points to the installed and in-use RAM memory slots (In this case 2). In this case, the Maximum RAM Capacity for these 2 RAM slots is 8GB.
The succeeding entries (after Physical Memory Array) that read Memory Device further detail the usage of the 2 RAM slots from the above screen capture. We can see that the first RAM slot has a size of 2GB and the second one size of 4GB.
2. Using lshw Command
The lshw command also queries the Desktop Management Interface (DMI) for information related to the system hardware components. Its queried results can be in XML, HTML, or JSON format.
Its implementation is as follows:
$ sudo lshw -class memory
Under *-bank:0
we see that the first slot has a size of 2GB RAM and the second slot under *-bank:1
with an installed RAM size of 4GB.
Have other ideas/approaches to determining the number of RAM slots in use via Linux? Feel free to leave a comment.