请关注本头条号,每天坚持更新原创干货技术文章。 如需学习视频,请在微信搜索公众号“智传网优”直接开始自助视频学习。
1. dmidecode命令简介
dmidecode 使用 SMBIOS/DMI 标准,在Linux下收集相关硬件信息。
2. 安装dmidecode
以CentOS7.5 为例,最小化安装默认并没有包括这个工具,需要安装
[root@zcwyou ~]# 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. 查看服务器型号
[root@zcwyou ~]# dmidecode | grep 'Product Name'
Product Name: PowerEdge R410
Product Name: 01123648
4. 查找主板序列号
[root@controller_slave ~]# dmidecode -s system-serial-number
2412345W1
5. 查看服务器OEM信息:
[root@controller_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查看内存详细信息
[root@controller_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根内存。
[root@controller_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查看主板支持的最大内存
[root@controller_slave ~]# dmidecode|grep 'Maximum Capacity'
Maximum Capacity: 128 GB
6.4 Linux查看内存信息
[root@controller_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系统查看内存规格信息
[root@controller_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以上。
[root@controller_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