Dmidecode command details (obtain hardware information)
I. Introduction to dmidecode
Dmidecode allows you to obtain hardware information in Linux. Dmidecode complies with the SMBIOS/DMI standard. The output information includes BIOS, system, motherboard, processor, memory, cache, and so on.
DMI is a Management system that helps collect computer system information. DMI information must be collected in strict compliance with SMBIOS specifications. System Management BIOS (SMBIOS) is a unified specification for the motherboard or System manufacturer to display product Management information in a standard format. SMBIOS and DMI are open technical standards drafted by the industry-leading organization Desktop Management Task Force (DMTF), where DMI design applies to any platform and operating system.
DMI acts as an interface between the management tool and the system layer. It has established a standard manageable system to make it easier for computer vendors and users to understand the system. The main component of DMI is the Management Information Format (MIF) database. This database contains all information about computer systems and accessories. DMI allows you to obtain the serial number, computer vendor, serial port information, and other system accessories.
Ii. Role of dmidecode
Dmidecode decodes the information in the DMI database and displays it in readable text. Because DMI information can be manually modified, the information in it is not necessarily accurate information of the system.
Iii. dmidecode command usage
Running dmidecode without option usually outputs all hardware information. Dmidecode has a very useful option-t, which can specify the type of output information. To obtain information about the processor, run: dmidecode-t processor.
Usage: dmidecode [OPTIONS]
Options are:
-D :( default:/dev/mem) reads information from the device file, and the output content is the same as the standard output without parameters.
-H: displays help information.
-S: only information of the specified DMI string is displayed. (String)
-T: displays only the information of a specified entry. (Type)
-U: displays undecoded original entries.
-- Dump-bin FILE: Dump the DMI data to a binary file.
-- From-dump FILE: Read the DMI data from a binary file.
-V: displays version information.
Dmidecode output format is generally as follows:
Handle 0x0002, DMI type 2, 95 bytes.
Base Board Information
Manufacturer: IBM
Product Name: Node1 Processor Card
Version: Not Specified
Serial Number: Not Specified
The recode header includes:
Recode id (Handle): record identifier in the DMI table, which is unique. For example, Handle 0x0002 in the preceding example.
DMI type id: indicates the record type, such as BIOS and Memory. The preceding example is type 2, that is, "Base Board Information ".
Recode size: the size of the corresponding record in the DMI table. The preceding example is 95 bytes. (Excluding text information, all actual output content is larger than this size ). After the record header is the record value.
Recoded values: the record value can be multiple rows. For example, the previous example shows the Manufacturer (Manufacturer), Product Name, Version, and Serial Number of the motherboard.
1. display all dmi information in the simplest way:
[Root @ BAIYU_180 ~] # Dmidecode
[Root @ BAIYU_180 ~] # Dmidecode | wc-l
6042
This will output all dmi information, and you may be frightened by a large amount of information. You can usually use the following method.
2. display information of the specified type:
Generally, I only want to view information of a certain type, such as CPU, memory, or disk, instead of all. You can use-t (-type TYPE) to specify the information type:
# Dmidecode-t bios
# Dmidecode-t bios and processor)
# Dmidecode-t (displays bios and processor)
What types does dmidecode support?
You can see these in man dmidecode:
Supported text parameters:
Bios, system, baseboard, chassis, processor, memory, cache, connector, slot
Many numeric parameters are supported: (see the appendix)
4. View information using keywords:
For example, if you only want to view the serial number, you can use:
# Dmidecode-s system-serial-number
-S (-string keyword) supports the following keywords:
Bios-vendor, bios-version, bios-release-date,
System-manufacturer, system-product-name, system-version, system-serial-number,
Baseboard-manu-facturer, baseboard-product-name, baseboard-version, baseboard-serial-number, baseboard-asset-tag,
Chassis-manufacturer, chas-sis-version, chassis-serial-number, chassis-asset-tag,
Processor-manufacturer, processor-version.
Iv. Instances
View the current memory and the maximum supported memory
In Linux, you can use free or meminfo to obtain the current physical memory:
[Root @ SC4304 ~] # Free
Total used free shared buffers cached
Mem: 132091660 5649612 126442048 0 224492 4052384
-/+ Buffers/cache: 1372736 130718924
Swap: 209715192 0 209715192
[Root @ scloud 5 ~] # Free-m
Total used free shared buffers cached
Mem: 128995 6230 122765 0 259 4615
-/+ Buffers/cache: 1354 127640
Swap: 204799 0 204799
It shows that the physical memory of the current server is 128 GB.
How much memory can the server expand?
[Root @ SC4304 ~] # Dmidecode-t 16
# Dmidecode 2.11
# SMBIOS entry point at 0xb89a5000
SMBIOS 2.7 present.
Handle 0x1000, DMI type 16, 23 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: Multi-bit ECC
Maximum Capacity: 1536 GB
Error Information Handle: Not Provided
Number Of Devices: 24
We can see from the above information:
Memory slots: 24
Maximum extended memory: 1536 GB
Maximum single-stick memory: 64 GB
Current memory: 128 GB
However, we still need to find out whether the GB is 16*8 GB, 2*64 GB, or anything else? Is to view the number of used Slots
If it is 2*64 GB, it can be expanded to 1536 GB, but if the slot is full, it cannot be expanded:
1. Check the number of memory slots, memory slots inserted, and the size
[Root @ scloud 5 ~] # Dmidecode | grep-A5 'memory devic' | grep Size
Size: 16384 MB
Size: 16384 MB
Size: 16384 MB
Size: 16384 MB
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: 16384 MB
Size: 16384 MB
Size: 16384 MB
Size: 16384 MB
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
2. view the maximum number of supported memory
[Root @ scloud 5 ~] # Dmidecode | grep 'maximum Capacity'
Maximum Capacity: 1536 GB
3. Check the memory speed on the slot. If the slot is not inserted, it is unknown.
[Root @ scloud 5 ~] # Dmidecode | grep-A16 'memory devic' | grep 'speed'
Speed: 1600 MHz
Speed: 1600 MHz
Speed: 1600 MHz
Speed: 1600 MHz
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: 1600 MHz
Speed: 1600 MHz
Speed: 1600 MHz
Speed: 1600 MHz
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
5. A shell script for viewing basic hardware information
[Root @ sc00006 test] # cat test. sh
#! /Bin/bash
Echo "IP :"
Ifconfig | grep "inet addr" | grep-v 127.0.0.1 | awk '{print $2}' | awk-F': ''{print $2 }'
Echo "Product Name :"
Dmidecode | grep Name
Echo "CPU Info :"
Dmidecode | grep-I cpu | grep-I version | awk-F': ''{print $2 }'
Echo "Disk Info :"
Parted-l | grep 'disk/dev/sd' | awk-F', ''{print" ", $1 }'
Echo "Network Info :"
Lspci | grep Ethernet
Echo "Memory Info :"
Dmidecode | grep-A5 "Memory Device" | grep Size | grep-v No
Echo "Memory number:" 'dmidecode | grep-A5 "Memory Device" | grep Size | grep-v No | wc-l'
Output result:
[Root @ sc00006 test] # bash test. sh
IP:
10.0.17.6
10.0.250.6
Product Name:
Product Name: PowerEdge R720
SKU Number: SKU = NotProvided; ModelName = PowerEdge R720
Product Name: 0DCWD1
CPU Info:
Intel (R) Xeon (R) CPU E5-2620 v2 @ 2.10 GHz
Intel (R) Xeon (R) CPU E5-2620 v2 @ 2.10 GHz
Disk Info:
Disk/dev/sda: 1074 GB
Disk/dev/sdb: 18.9 TB
Network Info:
0:00. 0 Ethernet controller: Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet PCIe
0:00. 1 Ethernet controller: Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet PCIe
. 0 Ethernet controller: Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet PCIe
. 1 Ethernet controller: Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet PCIe
Memory Info:
Size: 16384 MB
Size: 16384 MB
Size: 16384 MB
Size: 16384 MB
Size: 16384 MB
Size: 16384 MB
Size: 16384 MB
Size: 16384 MB
Memory number: 8
This article permanently updates the link address: