如何使用dmidecode在Linux上检查硬件信息

时间:2020-02-23 14:37:48  来源:igfitidea点击:

本指南将了解如何使用dmidecode在Linux上检查硬件信息。大多数笔记本电脑对可以安装的最大内存有限制。知道此限制将相应地计划硬件升级。

什么是dmidecode?

这是用于以人类可读格式转储计算机DMI的工具。数据以表格形式打印,其中包含对系统硬件组件的描述,以及其他有用的信息,例如序列号和BIOS版本。

使用dmidecode在Linux上检查内存信息:

要获取Linux服务器上所有内存信息的详细信息,请运行dmidecode with-toption,如下所示。

$sudo dmidecode -t memory
# dmidecode 3.2
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.

Handle 0x0007, DMI type 16, 23 bytes
Physical Memory Array
	Location: System Board Or Motherboard
	Use: System Memory
	Error Correction Type: None
	Maximum Capacity: 16 GB
	Error Information Handle: Not Provided
	Number Of Devices: 2

Handle 0x001A, DMI type 17, 34 bytes
Memory Device
	Array Handle: 0x0007
	Error Information Handle: Not Provided
	Total Width: 64 bits
	Data Width: 64 bits
	Size: 8192 MB
	Form Factor: SODIMM
	Set: None
	Locator: DIMM1
	Bank Locator:  
	Type: DDR3
	Type Detail: Synchronous
	Speed: 1600 MT/s
	Manufacturer: Samsung
	Serial Number: 20DE69E3
	Asset Tag: 03151600  
	Part Number: M471B1G73QH0-YK0  
	Rank: 2
	Configured Memory Speed: 1600 MT/s

Handle 0x001C, DMI type 17, 34 bytes
Memory Device
	Array Handle: 0x0007
	Error Information Handle: Not Provided
	Total Width: 64 bits
	Data Width: 64 bits
	Size: 8192 MB
	Form Factor: SODIMM
	Set: None
	Locator: DIMM2
	Bank Locator:  
	Type: DDR3
	Type Detail: Synchronous
	Speed: 1600 MT/s
	Manufacturer: Samsung
	Serial Number: 20DE69E4
	Asset Tag: 03151600  
	Part Number: M471B1G73QH0-YK0  
	Rank: 2
	Configured Memory Speed: 1600 MT/s

从输出中,我们可以获得:内存最大容量设备数量RAM外形尺寸例如SODIMM 等安装的设备大小MT/s中的时钟速度类型例如DDR4,DDR3 等电压

我们可以使用grep进一步过滤详细信息

$sudo dmidecode -t memory | grep -i "maximum capacity"
 Maximum Capacity: 32 GB

$sudo dmidecode -t memory | grep -i "speed"
 Speed: 2133 MT/s
 Configured Clock Speed: 2133 MT/s
 Speed: 2133 MT/s
 Configured Clock Speed: 2133 MT/s

使用dmidecode在Linux上检查处理器信息

要查看所有与处理器有关的信息,请使用以下命令:

$sudo dmidecode -t processor               
# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 3.0.0 present.

Handle 0x0009, DMI type 4, 48 bytes
Processor Information
	Socket Designation: U3E1
	Type: Central Processor
	Family: Core i5
	Manufacturer: Intel(R) Corporation
	ID: E9 06 08 00 FF FB EB BF
	Signature: Type 0, Family 6, Model 142, Stepping 9
	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) Core(TM) i5-7200U CPU @ 2.50GHz
	Voltage: 0.8 V
	External Clock: 100 MHz
	Max Speed: 2700 MHz
	Current Speed: 2400 MHz
	Status: Populated, Enabled
	Upgrade: Other
	L1 Cache Handle: 0x0006
	L2 Cache Handle: 0x0007
	L3 Cache Handle: 0x0008
	Serial Number: To Be Filled By O.E.M.
	Asset Tag: To Be Filled By O.E.M.
	Part Number: To Be Filled By O.E.M.
	Core Count: 2
	Core Enabled: 2
	Thread Count: 4
	Characteristics:
		64-bit capable
		Multi-Core
		Hardware Thread
		Execute Protection
		Enhanced Virtualization
		Power/Performance Control

我们可以从中获得:CPU系列支持的标志处理器版本等

对于系统信息,请运行:

$sudo dmidecode -t system
# dmidecode 3.2
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
	Manufacturer: Dell Inc.
	Product Name: Dell Precision M3800
	Version: A10
	Serial Number: 2FQF562
	UUID: 4c4c4544-0046-5110-8046-b2c04f353632
	Wake-up Type: Power Switch
	SKU Number: Dell Precision M3800
	Family:                       

Handle 0x0013, DMI type 12, 5 bytes
System Configuration Options
	Option 1: To Be Filled By O.E.M.

Handle 0x0016, DMI type 23, 13 bytes
System Reset
	Status: Disabled
	Watchdog Timer: Not Present

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

获取系统UUID

要获取系统UUID,请运行:

$sudo dmidecode --string system-uuid
0B1B6E67-A5F9-6546-BCF6-A81E84B0E901

我们可以使用以下命令将输出转换为小写:

$sudo dmidecode --string system-uuid | tr '[:upper:]' '[:lower:]'
0b1b6e67-a5f9-6546-bcf6-a81e84b0e901

这将为我们提供系统信息,例如硬件制造商,系统家族,产品名称等。有关更详细的操作指南,请参阅:

$dmidecode --help
Usage: dmidecode [OPTIONS]
Options are:
 -d, --dev-mem FILE     Read memory from device FILE (default: /dev/mem)
 -h, --help             Display this help text and exit
 -q, --quiet            Less verbose output
 -s, --string KEYWORD   Only display the value of the given DMI string
 -t, --type TYPE        Only display the entries of given type
 -H, --handle HANDLE    Only display the entry of given handle
 -u, --dump             Do not decode the entries
     --dump-bin FILE    Dump the DMI data to a binary file
     --from-dump FILE   Read the DMI data from a binary file
     --no-sysfs         Do not attempt to read DMI data from sysfs files
     --oem-string N     Only display the value of the given OEM string
 -V, --version          Display the version and exit

尝试使用其他dmidecode选项来获取所需的系统详细信息。