Linux 下读取硬件信息 dmidecode 命令介绍

dmidecode 是一个工具或命令,以人类可读的格式检索系统硬件的有用信息。dmidecode 可用于所有类似 Linux 的系统 (RHEL, CentOS, Debian 和 SUSE)。dmidecode 代表 DMI (Desktop Management Interface) 它从 DMI 表中读取数据,并以人类可读的格式展示给我们。DMI 表保存了系统硬件的详细信息,如 BIOS,序列号,RAM 和 CPU 详细信息等,除此之外,dmidecode 还可以检索关于系统支持的最大配置的详细信息。

在本文中,我们将介绍 12 个Linux 系统下 dmidecode 相关示例。

1) dmidecode 命令输出

When we run the dmidecode command then it displays the output on the
screen, in the output we have the records, each record has 4 different
values.

当我们运行 dmidecode 命令时,会在屏幕上输出记录,每个记录有 4 个不同的值。

  • Handle – 唯一标识符号
  • Type – 它讲述的是硬件组成,在下面的示例中,DMI 类型 38 指的是 IPMI 设备
  • Size – 记录大小
  • Decoded value – 关于记录类型的信息,在下面的示例中,IPMI 设备的解码值是接口类型,规格版本,基址和寄存器间距

让我们运行 dmidecode 命令

[root@linuxtechi ~]# dmidecode | more

输出如下所示

Linux 下读取硬件信息 dmidecode 命令介绍_第1张图片

2) 用于 dmidecode 命令不同的 DMI 类型

以下是 dmidecode 命令中使用的 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 Access31   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
Keyword     Types
       ------------------------------
       bios        0, 13
       system      1, 12, 15, 23, 32
       baseboard   2, 10, 41
       chassis     3
       processor   4
       memory      5, 6, 16, 17
       cache       7
       connector   8
       slot        9

3) 使用类型 id 显示硬件信息

在 dmidecode 命令中,我们可以使用关键字或类型 id 来获取系统的硬件信息。在例 2 中,我们已经列出了关键字及其类型 id。让我们假设我们想要显示系统的 cache 信息,然后我们可以运行下面的任何命令

[root@linuxtechi ~]# dmidecode -t cache
Or
[root@linuxtechi ~]# dmidecode -t 7
# dmidecode 2.12
SMBIOS 2.5 present.
Handle 0x009C, DMI type 7, 19 bytes
Cache Information
        Socket Designation: L1-Cache
        Configuration: Enabled, Not Socketed, Level 1
        Operational Mode: Write Back
        Location: Internal
        Installed Size: 192 kB
        Maximum Size: 192 kB
        Supported SRAM Types:
                Synchronous
        Installed SRAM Type: Synchronous
        Speed: Unknown
        Error Correction Type: Single-bit ECC
        System Type: Data
        Associativity: 8-way Set-associative

Handle 0x009D, DMI type 7, 19 bytes
Cache Information
        Socket Designation: L1-Cache
        Configuration: Enabled, Not Socketed, Level 1
        Operational Mode: Write Back
        Location: Internal
        Installed Size: 192 kB
        Maximum Size: 192 kB
        Supported SRAM Types:
                Synchronous
        Installed SRAM Type: Synchronous
        Speed: Unknown
        Error Correction Type: Single-bit ECC
        System Type: Instruction
        Associativity: 4-way Set-associative
…………………………………………………………………………

4) 显示 BIOS 信息

运行 dmidecode 命令后输入 bios 作为类型

[root@linuxtechi ~]# dmidecode --type bios
 Or
[root@linuxtechi ~]# dmidecode -t bios
# dmidecode 2.12
SMBIOS 2.5 present.
Handle 0x0005, DMI type 0, 24 bytes
BIOS Information
        Vendor: Intel Corp.
        Version: QSSC-S4R.QCI.01.00.0037.061120141015
        Release Date: 06/11/2014
        Address: 0xF0000
        Runtime Size: 64 kB
        ROM Size: 16384 kB
        Characteristics:
                PCI is supported
                PNP is supported
                BIOS is upgradeable
                BIOS shadowing is allowed
                Boot from CD is supported
                Selectable boot is supported
                EDD is supported
                3.5"/2.88 MB floppy services are supported (int 13h)
                Print screen service is supported (int 5h)
                8042 keyboard services are supported (int 9h)
                Serial services are supported (int 14h)
                CGA/mono video services are supported (int 10h)
                ACPI is supported
                USB legacy is supported
                LS-120 boot is supported
                ATAPI Zip drive boot is supported
                Function key-initiated network boot is supported
                Targeted content distribution is supported
        BIOS Revision: 17.18
        Firmware Revision: 0.0

5) 显示机箱硬件信息

执行以下 dmidecode 命令显示机箱信息

[root@linuxtechi ~]# dmidecode -t chassis
# dmidecode 2.12
SMBIOS 2.5 present.
Handle 0x0004, DMI type 3, 22 bytes
Chassis Information
        Manufacturer: ..............................
        Type: Main Server Chassis
        Lock: Not Present
        Version: 32S4RCS0010
        Serial Number: QTFCVR1110136
        Asset Tag: ....................
        Boot-up State: Safe
        Power Supply State: Safe
        Thermal State: Safe
        Security Status: Unknown
        OEM Information: 0x01000181
        Height: 1 U
        Number Of Power Cords: 1
        Contained Elements: 0
        SKU Number: Not Specified

6) 显示底板硬件信息

执行下面的 dmidecode 命令来显示关于系统底板的硬件信息

[root@linuxtechi ~]# dmidecode -t baseboard
# dmidecode 2.12
SMBIOS 2.5 present.
Handle 0x0003, DMI type 2, 16 bytes
Base Board Information
        Manufacturer: QCI
        Product Name: QSSC-S4R
        Version: 31S4RMB00B0
        Serial Number: LVR1340271
        Asset Tag: ....................
        Features:
                Board is a hosting board
                Board is replaceable
        Location In Chassis: Not Specified
        Chassis Handle: 0x0004
        Type: Motherboard
        Contained Object Handles: 0

Handle 0x0027, DMI type 10, 6 bytes
On Board Device Information
        Type: Video
        Status: Enabled
        Description: ServerEngines Pilot II

Handle 0x0028, DMI type 10, 6 bytes
On Board Device Information
        Type: Ethernet
        Status: Enabled
        Description: Intel Dual GbE #1

Handle 0x0029, DMI type 10, 6 bytes
On Board Device Information
        Type: Ethernet
        Status: Enabled
        Description: Intel Dual GbE #2

Handle 0x002A, DMI type 10, 6 bytes
On Board Device Information
        Type: SATA Controller
        Status: Enabled
        Description: ICH10 Integrated SATA Controller

7) 显示系统的硬件信息

要显示有关系统的硬件信息(制造商、产品名称和序列号等),运行以下 dmidecode 命令

[root@linuxtechi ~]# dmidecode -t system
# dmidecode 2.12
SMBIOS 2.5 present.
Handle 0x0002, DMI type 1, 27 bytes
System Information
        Manufacturer: QCI
        Product Name: QSSC-S4R
        Version: ....................
        Serial Number: ............
        UUID: 2DD583E2-4A58-11E0-A580-00101859A783
        Wake-up Type: AC Power Restored
        SKU Number: Not Specified
        Family: Not Specified

Handle 0x002C, DMI type 12, 5 bytes
System Configuration Options
        Option 1: J5C3 2-3: Close to clear Password

Handle 0x002D, DMI type 12, 5 bytes
System Configuration Options
        Option 1: J5C2 2-3: Close to clear CMOS

Handle 0x002E, DMI type 12, 5 bytes
System Configuration Options
        Option 1: J6D1 2-3: Close for BIOS Recovery

Handle 0x002F, DMI type 12, 5 bytes
System Configuration Options
        Option 1: J5C1 2-3: Close to Force ME Update Mode

Handle 0x0030, DMI type 12, 5 bytes
System Configuration Options
        Option 1: J9C3: SATA RAID Key

Handle 0x0031, DMI type 12, 5 bytes
System Configuration Options
        Option 1: J5A1 2-3: Close to Force BMC Update Mode

Handle 0x0034, DMI type 32, 20 bytes
System Boot Information
        Status: No errors detected

8) 显示已安装的内存信息

要显示有关已安装的物理内存(RAM)的信息,请运行以下命令

[root@linuxtechi ~]# dmidecode -t 17 
# dmidecode 2.12
SMBIOS 2.5 present.
Handle 0x0043, DMI type 17, 27 bytes
Memory Device
        Array Handle: 0x0035
        Error Information Handle: Not Provided
        Total Width: 72 bits
        Data Width: 72 bits
        Size: 4096 MB
        Form Factor: DIMM
        Set: 1
        Locator: DIMM_1B
        Bank Locator: MEM1 SLOT
        Type: DDR3
        Type Detail: Synchronous
        Speed: 1067 MHz
        Manufacturer: 0x0198
        Serial Number: 0xA504DB27
        Asset Tag: Unknown
        Part Number: 9965426-047.A00LF

Handle 0x0045, DMI type 17, 27 bytes
Memory Device
        Array Handle: 0x0035
        Error Information Handle: Not Provided
        Total Width: 72 bits
        Data Width: 72 bits
        Size: 4096 MB
        Form Factor: DIMM
        Set: 2
        Locator: DIMM_1A
        Bank Locator: MEM1 SLOT
        Type: DDR3
        Type Detail: Synchronous
        Speed: 1067 MHz
        Manufacturer: 0x830B
        Serial Number: 0x6C443023
…………………………………………………………

使用下面的 dmidecode 命令查找系统支持的最大物理内存

[root@linuxtechi ~]# dmidecode -t 16 
# dmidecode 2.12
SMBIOS 2.5 present.
Handle 0x0035, DMI type 16, 15 bytes
Physical Memory Array
        Location: Proprietary Add-on Card
        Use: System Memory
        Error Correction Type: Multi-bit ECC
        Maximum Capacity: 256 GB
        Error Information Handle: Not Provided
        Number Of Devices: 8

Handle 0x0037, DMI type 16, 15 bytes
Physical Memory Array
        Location: Proprietary Add-on Card
        Use: System Memory
        Error Correction Type: Multi-bit ECC
        Maximum Capacity: 256 GB
        Error Information Handle: Not Provided
        Number Of Devices: 8

Handle 0x0039, DMI type 16, 15 bytes
Physical Memory Array
        Location: Proprietary Add-on Card
        Use: System Memory
        Error Correction Type: Multi-bit ECC
        Maximum Capacity: 256 GB
        Error Information Handle: Not Provided
        Number Of Devices: 8
……………………………………………………………

9) 显示关于处理器的硬件信息

执行以下 dmidecode 命令显示处理器或 CPU 插座的硬件信息

[root@linuxtechi ~]# dmidecode -t processor
or
[root@linuxtechi ~]# dmidecode -t 4
# dmidecode 2.12
SMBIOS 2.5 present.
Handle 0x009B, DMI type 4, 40 bytes
Processor Information
        Socket Designation: CPU1
        Type: Central Processor
        Family: Xeon MP
        Manufacturer: Intel(R) Corporation
        ID: E6 06 02 00 FF FB EB BF
        Signature: Type 0, Family 6, Model 46, Stepping 6
        Flags:
                FPU (Floating-point unit on-chip)
                VME (Virtual mode extension)
                DE (Debugging extension)
                PSE (Page size extension)
                TSC (Time stamp counter)
                MSR (Model specific registers)
                PAE (Physical address extension)
                MCE (Machine check exception)
                CX8 (CMPXCHG8 instruction supported)
                APIC (On-chip APIC hardware supported)
                SEP (Fast system call)
                MTRR (Memory type range registers)
                PGE (Page global enable)
                MCA (Machine check architecture)
                CMOV (Conditional move instruction supported)
                PAT (Page attribute table)
                PSE-36 (36-bit page size extension)
                CLFSH (CLFLUSH instruction supported)
                DS (Debug store)
                ACPI (ACPI supported)
                MMX (MMX technology supported)
                FXSR (FXSAVE and FXSTOR instructions supported)
                SSE (Streaming SIMD extensions)
                SSE2 (Streaming SIMD extensions 2)
                SS (Self-snoop)
                HTT (Multi-threading)
                TM (Thermal monitor supported)
                PBE (Pending break enabled)
        Version: Intel(R) Xeon(R) CPU           E7540  @ 2.00GHz
        Voltage: 1.2 V
        External Clock: 133 MHz
        Max Speed: 4000 MHz
        Current Speed: 2000 MHz
        Status: Populated, Enabled
        Upgrade: Socket LGA1567
        L1 Cache Handle: 0x009D
        L2 Cache Handle: 0x009E
        L3 Cache Handle: 0x009F
        Serial Number: Not Specified
        Asset Tag: Not Specified
        Part Number: Not Specified
        Core Count: 6
        Core Enabled: 6
        Thread Count: 12
        Characteristics:
                64-bit capable
…………………………………………………

10) 显示有关 64 位内存错误的信息

要显示系统的 64 位内存错误信息,请运行以下命令

[root@linuxtechi ~]# dmidecode -t 33

11) 以十六进制输出 DMIDECODE 命令输出

如果您不想解码 dmidecode 命令的输出信息,但希望将其转储为 16 进制格式,则可以在 dmidecode 命令中使用 -u 或 dump 选项,示例如下

[root@linuxtechi ~]# dmidecode -u -t 4
or
[root@linuxtechi ~]# dmidecode --dump -t 4

12 ) 显示 dmidecode 版本

使用下面的 dmidecode 命令显示它的版本

[root@linuxtechi ~]# dmidecode -V
2.12
[root@linuxtechi ~]#

我的开源项目

酷瓜云课堂-在线教育解决方案

你可能感兴趣的:(linux)