請關注本頭條号,每天堅持更新原創幹貨技術文章。 如需學習視訊,請在微信搜尋公衆号“智傳網優”直接開始自助視訊學習。
1. dmidecode指令簡介
dmidecode 使用 SMBIOS/DMI 标準,在Linux下收集相關硬體資訊。
2. 安裝dmidecode
以CentOS7.5 為例,最小化安裝預設并沒有包括這個工具,需要安裝
[[email protected] ~]# yum -y install dmidecode
輸出最後,類似于以下的内容,表明安裝成功:
Running Transaction
Installing : 1:dmidecode-3.0-5.el7.x86_64.x86_64 1/1
Verifying : 1:dmidecode-3.0-5.el7.x86_64.x86_64 1/1
Installed:
dmidecode-3.0-5.el7
Complete!
3. 檢視伺服器型号
[[email protected] ~]# dmidecode | grep 'Product Name'
Product Name: PowerEdge R410
Product Name: 01123648
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLicmbw5iZwUGZkVWMkVWO1gzY3IzM3QTZyMmMxIWM2MzMiNmM58CX0JXZ252bj91Ztl2Lc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.png)
4. 查找主機闆序列号
[[email protected]_slave ~]# dmidecode -s system-serial-number
2412345W1
5. 檢視伺服器OEM資訊:
[[email protected]_slave ~]# dmidecode -t 11
#dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.6 present.
Handle 0x0B00, DMI type 11, 5 bytes
OEM Strings
String 1: Dell System
String 2: 5[0000]
6. 檢視記憶體資訊
真實伺服器部分輸出資訊
6.1檢視記憶體詳細資訊
[[email protected]_slave ~]# dmidecode -t memory
Handle 0x1000, DMI type 16, 15 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: Multi-bit ECC
Maximum Capacity: 128 GB
Error Information Handle: Not Provided
Number Of Devices: 8
以上為彙總資訊:
Maximum Capacity: 主機闆最大支援的記憶體
Number Of Devices: 主機闆的記憶體插槽數量
以下為每個記憶體槽資訊
有記憶體的存槽:
Handle 0x1100, DMI type 17, 28 bytes
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 8192 MB
Form Factor: DIMM
Set: 1
Locator: DIMM_A1
Bank Locator: Not Specified
Type: DDR3
Type Detail: Synchronous Registered (Buffered)
Speed: 1333 MHz
Manufacturer: 00CE00B380CE
Serial Number: 83BB0BB1
Asset Tag: 02120463
Part Number: M393B1K70DH0-YH9
Rank: 2
沒有記憶體的存槽:
Handle 0x110C, DMI type 17, 28 bytes
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: DIMM
Set: 4
Locator: DIMM_B4
Bank Locator: Not Specified
Type: DDR3
Type Detail: Synchronous
Speed: Unknown
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Rank: Unknown
以下輸出表示沒有記憶體:
Size: No Module Installed
Speed: Unknown
6.2 檢視記憶體的彙總資訊
可以看到8根記憶體槽插了4根記憶體。
[[email protected]_slave ~]# dmidecode|grep -P -A5 "Memorys+Device"|grep Size|grep -v Range
Size: 8192 MB
Size: 8192 MB
Size: 8192 MB
Size: 8192 MB
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
6.3 Linux檢視主機闆支援的最大記憶體
[[email protected]_slave ~]# dmidecode|grep 'Maximum Capacity'
Maximum Capacity: 128 GB
6.4 Linux檢視記憶體資訊
[[email protected]_slave ~]# dmidecode -t 16
#dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.6 present.
Handle 0x1000, DMI type 16, 15 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: Multi-bit ECC
Maximum Capacity: 128 GB
Error Information Handle: Not Provided
Number Of Devices: 8
6.5 Linux系統檢視記憶體規格資訊
[[email protected]_slave ~]# dmidecode|grep -A16 'Memory Device'|grep 'Speed'
Speed: 1333 MHz
Speed: 1333 MHz
Speed: 1333 MHz
Speed: 1333 MHz
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
7. Linux系統檢視CPU詳細資訊
以下輸出表明該伺服器有2個實體CPU,伺服器一般都是2個實體CPU以上。
[[email protected]_slave ~]# dmidecode -t processor
#dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.6 present.
Handle 0x0004, DMI type 4, 40 bytes
Processor Information
Socket Designation: CPU 1
Type: Central Processor
Family: Core 2 Quad
Manufacturer: Intel
ID: 77 06 01 00 FF FB EB BF
Signature: Type 0, Family 6, Model 23, Stepping 7
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)2 Quad CPU Q9300 @ 2.50GHz
Voltage: 1.2 V
External Clock: 333 MHz
Max Speed: 2500 MHz
Current Speed: 2500 MHz
Status: Populated, Enabled
Upgrade: Socket 423
L1 Cache Handle: 0x0005
L2 Cache Handle: 0x0006
L3 Cache Handle: 0x0007
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: 4
Core Enabled: 4
Thread Count: 4
Characteristics:
64-bit capable
Handle 0x0401, DMI type 4, 40 bytes
Processor Information
Socket Designation: CPU2
Type: Central Processor
Family: Unknown
Manufacturer: Intel
ID: 00 00 00 00 00 00 00 00
Version: Not Specified
Voltage: 1.2 V
External Clock: Unknown
Max Speed: 2500 MHz
Current Speed: Unknown
Status: Unpopulated
Upgrade: Socket 423
L1 Cache Handle: 0x0003
L2 Cache Handle: 0x0004
L3 Cache Handle: 0x0005
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Characteristics:
64-bit capable
總結:dmidecode是一個強大的硬體查詢工具,可以通過它查詢硬體的詳細資訊。
點選了解更多,快速檢視更多的技術文章清單。
https://www.linuxrumen.com/cyml/380.html