How to retrieve hardware information with dmidecode on Linux

Dmidecode is a free and open source utility we can use to retrieve hardware information on Linux. The tool is available in the repositories of all the major Linux distributions, and is able to inspect and dump the content of the SMBIOS table.

In this tutorial we learn how to install dmidecode, and how to use it to retrieve information about the hardware configuration on Linux.

In this tutorial you will learn:

  • How to install dmidecode on the major Linux distributions
  • How information records reported by dmidecode are organized
  • How to use dmidecode to retrieve specific hardware information
How to retrieve hardware information with dmidecode on Linux
How to retrieve hardware information with dmidecode on Linux
Category Requirements, Conventions or Software Version Used
System Distribution independent
Software dmidecode
Other None
Conventions # – requires given linux-commands to be executed with root privileges either directly as a root user or by use of sudo command $ – requires given linux-commands to be executed as a regular non-privileged user

Installation

The dmidecode tool is available in the default repositories of all the major Linux distributions; chances are the utility is already installed in your system. If for some reasons it is not, here are the commands we can use it to install it on Archlinux and distributions member of the Fedora and Debian family:

DISTRIBUTION COMMAND
Fedora/Rhel/Rocky $ sudo dnf install dmidecode
Debian/Ubuntu $ sudo apt install dmidecode
Archlinux $ sudo pacman -S dmidecode

The DMI/SMBIOS table

DMI is the acronym of Desktop Management Interface; SMBIOS, instead stands for: System Management Bios. The two standards are developed by the Desktop MAnagement Task Force (DMTF). Their purpose is to let an Operating System easily access hardware information.



Twitter icon Follow LinuxConfig.org on Twitter for the latest tips and tricks about Linux!

On boot, the table containing those information is loaded in memory, and can be parsed by dedicated utilities like dmidecode. The table contains information such as the hardware vendor, configuration, serial numbers, list of ports, etc.

Using dmidecode

Let’s see some examples of how to use the dmidecode tool. When the utility is invoked without any options, it just produces an output which contains all the information it is able to retrieve. Information are organized in records. Here is an example:

$ sudo dmidecode
[...]
Handle 0x0003, DMI type 16, 23 bytes
Physical Memory Array
	Location: System Board Or Motherboard
	Use: System Memory
	Error Correction Type: None
	Maximum Capacity: 32 GB
	Error Information Handle: Not Provided
[...]

[ADLSOT2]The one above is, for obvious reasons, just a little extract of the output produced by the utility, and describes the memory configuration on my machine. Let’s analyze how the record is composed. Each record has:

  • A Handle or unique identifier (0x0003 in this case)
  • A DMI type, which in this case is 16, which refers to the Physical Memory Array. The SMBIOS specification encodes and associates a list of types in a table (more on this later). We can instruct dmidecode to return information related on specific types only.
  • The Size used to store the record, which, in this case is 23 bytes.
  • The actual values of the record, which varies depending on the record itself.

The DMI Types

As we already said, information are organized in types. The table below contains their associations:

DMI TYPE INFORMATION
0 Bios
1 System
2 Baseboard
3 Chassis
4 Processor
5 Memory Controller
6 Memory Module
7 Cache
8 Port Connector
9 System Slots
10 On Board Devices
11 OEM Strings
12 System Configuration Options
13 Bios Language
14 Group Associations
15 System Event Log
16 Physical Memory Array
17 Memory Device
18 32-bit Memory Error
19 Memory Array Mapped Address
20 Memory Device Mapped Address
21 Built-in Pointing Device
22 Portable Battery
23 System Reset
24 Hardware Security
25 System Power Controls
26 Voltage Probe
27 Cooling Device
28 Temperature Probe
29 Electrical Current Probe
30 Out-of-band Remote Access
31 Boot Integrity Services
32 System Boot
33 64-bit Memory Error
34 Management Device
35 Management Device Component
36 Management Device Threshold Data
37 Memory Channel
38 IPMI Device
39 Power Supply
40 Additional Information
41 Onboard Devices Extended Information
42 Management Controller Host Interface

DMI Types can be used to retrieve and filter specific information with dmidecode. All we have to do is to invoke the utility with the -t option (short for --type), and provide the DMI type we want to query as argument. Supposing we want to gather memory devices (17) information, we would run:

$ sudo dmidecode -t 17

On my machine, the output produced by the command, is the following:

# dmidecode 3.4
Getting SMBIOS data from sysfs.
SMBIOS 3.0.0 present.

Handle 0x0004, DMI type 17, 40 bytes
Memory Device
	Array Handle: 0x0003
	Error Information Handle: Not Provided
	Total Width: 64 bits
	Data Width: 64 bits
	Size: 8 GB
	Form Factor: SODIMM
	Set: None
	Locator: ChannelA-DIMM0
	Bank Locator: BANK 0
	Type: DDR4
	Type Detail: Synchronous Unbuffered (Unregistered)
	Speed: 2133 MT/s
	Manufacturer: Micron
	Serial Number: 00000000
	Asset Tag: None
	Part Number: 4ATS1G64HZ-2G3A1    
	Rank: 1
	Configured Memory Speed: 2133 MT/s
	Minimum Voltage: Unknown
	Maximum Voltage: Unknown
	Configured Voltage: 1.2 V

Handle 0x0005, DMI type 17, 40 bytes
Memory Device
	Array Handle: 0x0003
	Error Information Handle: Not Provided
	Total Width: Unknown
	Data Width: Unknown
	Size: No Module Installed
	Form Factor: Unknown
	Set: None
	Locator: ChannelB-DIMM0
	Bank Locator: BANK 2
	Type: Unknown

As you can see, there are two DDR4 memory banks available, and only one of 8GB is used (soldered). We can see that other precious information as the “Part Number” are also reported: this can be useful in case we want to be sure we buy compatible hardware.



Multiple DMI types can be query we just one command: we can either repeat the option, or provide a comma-separated list of type numbers as argument. To query both BIOS (0) and memory devices (17), for example, we would run:

$ sudo dmidecode --type 0,17

Conclusions

In this tutorial we learned how to install and use the dmidecode utility to retrieve hardware information on Linux. The tool is open source and available on all the major distributions: it is able to read and parse the SMBIOS table. We saw how each record displayed by the application is composed, and how to query specific information, which are organized in DMI Types.