使用DMidecode显示硬件信息的7种方法

时间:2020-03-05 15:27:18  来源:igfitidea点击:

dmidecode命令读取系统DMI(桌面管理界面)表以显示服务器的硬件和BIOS信息。

DMidecode的输出包含来自DMI表的几个记录。
此表包含了系统硬件组件的描述以及其他有用信息,如序列号,BIOS修订版等,在运行时,Dmidecode将尝试定位DMI表。
如果它成功,那么它将解析此表并显示这样的记录列表。

DMI表不仅描述了系统所做的内容,还可以报告可能的演进(例如最快支持的CPU或者支持的最大内存量)。

本教程介绍如何使用DMideCode获取Linux计算机上的硬件信息。

1)获取有关BIOS的硬件信息

要获取BIOS版本,供应商和其他详细信息,请使用"-T BIOS"选项

# dmidecode -t bios
# dmidecode 2.9
SMBIOS 2.31 present.
Handle 0x0000, DMI type 0, 20 bytes
BIOS Information
Vendor: Phoenix Technologies LTD
Version: 6.00
Release Date: 04/10/2007
Address: 0xE7A00
Runtime Size: 99840 bytes
ROM Size: 64 kB
Characteristics:
ISA is supported
PCI is supported
PC Card (PCMCIA) is supported
PNP is supported
APM is supported
BIOS is upgradeable
BIOS shadowing is allowed
ESCD support is available
USB legacy is supported
Smart battery is supported
BIOS boot specification is supported
[root@mailserver ~]#

2)获取有关系统的硬件信息

使用`-t系统填充系统以获取有关系统的硬件信息

# dmidecode -t system
# dmidecode 2.9
SMBIOS 2.31 present.
Handle 0x0001, DMI type 1, 25 bytes
System Information
Manufacturer: VMware, Inc.
Product Name: VMware Virtual Platform
Version: None
Serial Number: VMware-56 4d eb 70 28 36 a8 c0-08 bb 55 cf dc e6 4f 60
UUID: 564DEB70-2836-A8C0-08BB-55CFDCE64F60
Wake-up Type: Power Switch
Handle 0x001C, DMI type 15, 29 bytes
System Event Log
Area Length: 16 bytes
Header Start Offset: 0x0000
Header Length: 16 bytes
Data Start Offset: 0x0010
Access Method: General-purpose non-volatile data functions
Access Address: 0x0000
Status: Invalid, Full
Change Token: 0x00000036
Header Format: Type 1
Supported Log Type Descriptors: 3
Descriptor 1: POST error
Data Format 1: POST results bitmap
Descriptor 2: Single-bit ECC memory error
Data Format 2: Multiple-event
Descriptor 3: Multi-bit ECC memory error
Data Format 3: Multiple-event
Handle 0x0026, DMI type 23, 13 bytes
System Reset
Status: Enabled
Watchdog Timer: Present
Boot Option: Do Not Reboot
Boot Option On Limit: Do Not Reboot
Reset Count: Unknown
Reset Limit: Unknown
Timer Interval: Unknown
Timeout: Unknown
Handle 0x0029, DMI type 32, 20 bytes
System Boot Information
Status:
#

3)有关基板的硬件信息

使用-t baseboard获取有关仓库的信息

# dmidecode -t baseboard
# dmidecode 2.9
SMBIOS 2.31 present.
Handle 0x0002, DMI type 2, 8 bytes
Base Board Information
Manufacturer: Intel Corporation
Product Name: 440BX Desktop Reference Platform
Version: None
Serial Number: None
Handle 0x001A, DMI type 10, 8 bytes
On Board Device 1 Information
Type: Video
Status: Disabled
Description: VMware SVGA II
On Board Device 2 Information
Type: Sound
Status: Disabled
Description: ES1371
#

4)获取有关机箱的HW信息

使用-T chassis选项获取有关系统机箱的获取详细信息

# dmidecode -t chassis
# dmidecode 2.9
SMBIOS 2.31 present.
Handle 0x0003, DMI type 3, 17 bytes
Chassis Information
Manufacturer: No Enclosure
Type: Other
Lock: Not Present
Version: N/A
Serial Number: None
Asset Tag: No Asset Tag
Boot-up State: Safe
Power Supply State: Safe
Thermal State: Safe
Security Status: None
OEM Information: 0x00001234

同样,我们可以找到处理器,内存,缓存,连接器和插槽等硬件信息。

# dmidecode -t memory
# dmidecode -t cashe
# dmidecode -t processor
# dmidecode -t connector
# dmidecode -t slot

有DMI类型;此DMI类型ID将提供有关系统的特定硬件组件的信息。
有100多种类型,例如这里的例子是某种类型ID。

DMI类型

SMBIOS规范定义了以下DMI类型信息:

键入DMI.

0 BIOS
1 System
2 Base Board
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

另外,126型用于禁用条目,127型是表端标记。
128至255类型用于OEM特定数据。
Dmidecode将默认显示这些条目,但是当供应商为它们提供了贡献文档或者代码时,它只能对它们进行解码。
可以使用关键字而不是使用 - 型号而不是类型数字。
每个关键字等同于类型编号列表:

关键字类型
BIOS 0,13
系统1,12,15,23,32
底板2,10
底盘3.
处理器4.
内存5,6,16,17
缓存7.
连接器8.
插槽9.

5)获取处理器硬件信息

使用类型ID,我们可以获得处理器信息

# dmidecode -t 4 | head
# dmidecode 2.9
SMBIOS 2.31 present.
Handle 0x0004, DMI type 4, 35 bytes
Processor Information
Socket Designation: CPU socket #0
Type: Central Processor
Family: Unknown
Manufacturer: AuthenticAMD
ID: 23 0F 10 00 FF FB 8B 07

6)获得64位内存错误

使用-t id以获取内存错误信息

# dmidecode -t 33
# dmidecode 2.9
SMBIOS 2.31 present.
Handle 0x002A, DMI type 33, 31 bytes
64-bit Memory Error Information
Type: OK
Granularity: Unknown
Operation: Unknown
Vendor Syndrome: Unknown
Memory Array Address: 0x0000000080000000
Device Address: 0x0000000080000000
Resolution: Unknown

7)Grep选项以获取产品详细信息

自其大文件以来,我们可以使用Grep命令搜索我们寻找的字符串。

# dmidecode | grep -i prod