github访问、国外学习网站必备:SockBoom
或者网址:https://sockboom.shop/auth/register?affid=212828
dmidecode是Linux系统中自带的硬件查询工具;dmidecode的作用是将DMI数据库中的信息进行解码,然后以可读的方式显示。DMI(Desktop Management Interface, DMI)就是帮助收集电脑系统信息的管理系统,DMI信息的收集必须严格按照SMBIOS规范的前提下进行。SMBIOS(System Management BIOS)是主板或系统制造者以标准格式显示产品管理信息所需遵循的统一规范。SMBIOS和DMI是由行业指导机构Desktop Management Task Force (DMTF)起草的开放性技术标准,其中DMI设计适用于任何的平台和操作系统。通过DMI,用户可以获取服务器的序列号、电脑厂商、串口信息以及其他的系统配件信息。
dmidecode [选项]
-d: (default : /dev/mem) 从设备文件读取信息,输出内容与不加参数标准输出相同
-h: 显示帮助信息
-s: 只显示指定DMI字符串的信息
-t: 只显示指定条目的信息
-u: 显示未解码的原始条目内容
--dump-bin file: 将DMI数据转储到二进制文件中
--from-bin file: 从二进制文件读取DMI数据
-V: 显示版本信息
[root@localhost ~]$ dmidecode # 打印所有硬件信息
[root@localhost ~]$ dmidecode -q # 打印所有硬件信息,比较简洁
[root@localhost ~]$ dmidecode | grep 'Product Name' # 以过滤的方式来查看指定的硬件信息
# (查看服务器型号)
[root@localhost ~]$ dmidecode -t bios # 查看BIOS相关的硬件信息
[root@localhost ~]$ dmidecode -t system # 查看系统相关的硬件信息
[root@localhost ~]$ dmidecode -t baseboard # 查看主板相关的硬件信息
[root@localhost ~]$ dmidecode -t chassis # 查看机箱相关的硬件信息
[root@localhost ~]$ dmidecode -t processor # 查看处理器相关的硬件信息
[root@localhost ~]$ dmidecode -t memory # 查看内存相关的硬件信息
[root@localhost ~]$dmidecode |grep 'Serial Number' # 查看主板的序列号
[root@localhost ~]$dmidecode -s system-serial-number # 查看系统序列号
[root@localhost ~]$dmidecode -t 11 # 查看OEM信息
2.3.1 查询内存条条数
dmidecode -t 17 | grep "Size.*MB" | wc -l
2.3.2 查看主板信息
dmidecode -t 2 或者 dmidecode -t baseboard
结果:
[root@mysql ~]#dmidecode -t 2
# dmidecode 2.12
SMBIOS 2.5 present.
Handle 0x0002, DMI type 2, 15 bytes
Base Board Information
Manufacturer: ASUSTeK Computer INC.
Product Name: Z8NR-D12
Version: Rev 1.xxG
Serial Number: 120902356500037
Asset Tag: To Be Filled By O.E.M.
Features:
Board is a hosting board
Board is replaceable
Location In Chassis: To Be Filled By O.E.M.
Chassis Handle: 0x0003
Type: Motherboard
Contained Object Handles: 0
2.3.3 查询内存信息
# 查询服务器支持的最大内存
dmidecode -t 16
[root@mysql ~]#dmidecode -t 16
# dmidecode 2.12
SMBIOS 2.5 present.
Handle 0x0036, DMI type 16, 15 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: Multi-bit ECC
Maximum Capacity: 96 GB
Error Information Handle: Not Provided
Number Of Devices: 12
从这里可以看到服务器最大的支持内存为96G
然后使用以下命令查询机器可用的内存:
grep MemTotal /proc/meminfo
MemTotal: 32869848 kB
可以看到机器可用的内存为32G,也即我们可以再扩64G内存。
2.3.4 查看当前内存数和插槽数
dmidecode|grep -P -A5 "Memory Device" | grep Size
[root@mysql ~]#dmidecode|grep -P -A5 "Memory Device" |grep Size
Size: 16384 MB
Range Size: 1 kB
Size: No Module Installed
Range Size: 1 kB
Size: No Module Installed
Range Size: 1 kB
Size: No Module Installed
Range Size: 1 kB
Size: No Module Installed
Range Size: 1 kB
Size: No Module Installed
Range Size: 1 kB
Size: 16384 MB
Range Size: 1 kB
Size: No Module Installed
Range Size: 1 kB
Size: No Module Installed
Range Size: 4032 GB
Size: No Module Installed
Range Size: 1 kB
Size: No Module Installed
Range Size: 1 kB
Size: No Module Installed
Range Size: 1 kB
2.3.5 查看物理CPU信息
dmidecode -t 4 或者 cat /proc/cpuinfo
[root@mysql ~]# dmidecode -t 4
# dmidecode 2.12
SMBIOS 2.5 present.
Handle 0x0004, DMI type 4, 40 bytes
Processor Information
Socket Designation: CPU 1
Type: Central Processor
Family: Xeon
Manufacturer: Intel
ID: C2 06 02 00 FF FB EB BF
Signature: Type 0, Family 6, Model 44, Stepping 2
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 E5620 @ 2.40GHz
Voltage: 1.2 V
External Clock: 133 MHz
Max Speed: 3600 MHz
Current Speed: 2400 MHz
Status: Populated, Enabled
Upgrade: Socket LGA1366
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: 8
Characteristics:
64-bit capable
Handle 0x0008, DMI type 4, 40 bytes
Processor Information
Socket Designation: CPU 2
Type: Central Processor
Family: Xeon
Manufacturer: Intel
ID: C2 06 02 00 FF FB EB BF
Signature: Type 0, Family 6, Model 44, Stepping 2
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 E5620 @ 2.40GHz
Voltage: 1.2 V
External Clock: 133 MHz
Max Speed: 3600 MHz
Current Speed: 2400 MHz
Status: Populated, Enabled
Upgrade: Socket LGA1366
L1 Cache Handle: 0x0009
L2 Cache Handle: 0x000A
L3 Cache Handle: 0x000B
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: 8
Characteristics:
64-bit capable
2.3.6 查看服务器硬件信息
cat /proc/scsi
[root@mysql ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 01 Id: 00 Lun: 00
Vendor: LSI Model: Logical Volume Rev: 3000
Type: Direct-Access ANSI SCSI revision: 06
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: SEAGATE Model: ST3300657SS Rev: 0008
Type: Direct-Access ANSI SCSI revision: 05
Host: scsi0 Channel: 00 Id: 01 Lun: 00
Vendor: SEAGATE Model: ST3300657SS Rev: 0008
Type: Direct-Access ANSI SCSI revision: 05
Host: scsi4 Channel: 00 Id: 00 Lun: 00
Vendor: TSSTcorp Model: CDDVDW SN-208BB Rev: AS01
Type: CD-ROM ANSI SCSI revision: 05
2.3.7 查看内存速率
dmidecode|grep -A16 "Memory Device"|grep 'Speed'
[root@mysql ~]# dmidecode|grep -A16 "Memory Device"|grep 'Speed'
Speed: 1333 MHz
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: 1333 MHz
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
没插就是Unknown
2.3.8 查看系统相关的硬件信息
dmidecode -t 1 或者 dmidecode -t system
dmidecode -t 1
# dmidecode 2.12
SMBIOS 2.5 present.
Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: System manufacturer
Product Name: System Product Name
Version: System Version
Serial Number: System Serial Number
UUID: 00797DF5-8DFE-D511-A89C-3085A9A895F8
Wake-up Type: Power Switch
SKU Number: To Be Filled By O.E.M.
Family: To Be Filled By O.E.M.
另外也可通过/proc查询CPU相关信息。
# 查询物理CPU个数:
[root@mysql ~]#cat /proc/cpuinfo |grep 'physical id'|sort|uniq|wc -l
2
# 查询CPU核数:
[root@mysql ~]#cat /proc/cpuinfo |grep 'core id'|wc -l
16
dmidecode -q
//BIOS相关的硬件信息
BIOS Information
Vendor: American Megatrends Inc.
Version: 1501
Release Date: 10/25/2011
Address: 0xF0000
Runtime Size: 64 kB
ROM Size: 2048 kB
Characteristics:
ISA is supported
PCI is supported
PNP is supported
APM is supported
BIOS is upgradeable
BIOS shadowing is allowed
ESCD support is available
Boot from CD is supported
Selectable boot is supported
BIOS ROM is socketed
EDD is supported
5.25"/1.2 MB floppy services are supported (int 13h)
3.5"/720 kB floppy services are supported (int 13h)
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)
Printer services are supported (int 17h)
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
BIOS boot specification is supported
Targeted content distribution is supported
BIOS Revision: 8.15
//系统相关的硬件信息
System Information
Manufacturer: System manufacturer # 厂商
Product Name: System Product Name # 服务器型号
Version: System Version # 版本号
Serial Number: System Serial Number # 主板序列号
UUID: 00797DF5-8DFE-D511-A89C-3085A9A895F8 # UUID
Wake-up Type: Power Switch
SKU Number: To Be Filled By O.E.M.
Family: To Be Filled By O.E.M.
Base Board Information
Manufacturer: ASUSTeK Computer INC.
Product Name: Z8NR-D12
Version: Rev 1.xxG
Serial Number: 120902356500037
Asset Tag: To Be Filled By O.E.M.
Features:
Board is a hosting board
Board is replaceable
Location In Chassis: To Be Filled By O.E.M.
Type: Motherboard
//机箱相关的硬件信息
Chassis Information
Manufacturer: Chassis Manufacture
Type: Desktop
Lock: Not Present
Version: Chassis Version
Serial Number: Chassis Serial Number
Asset Tag: Asset-1234567890
Boot-up State: Safe
Power Supply State: Safe
Thermal State: Safe
Security Status: None
OEM Information: 0x00000001
Height: Unspecified
Number Of Power Cords: 1
Contained Elements: 0
//处理器相关的硬件信息
Processor Information
Socket Designation: CPU 1
Type: Central Processor
Family: Xeon
Manufacturer: Intel
ID: C2 06 02 00 FF FB EB BF
Signature: Type 0, Family 6, Model 44, Stepping 2
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 E5620 @ 2.40GHz
Voltage: 1.2 V
External Clock: 133 MHz
Max Speed: 3600 MHz
Current Speed: 2400 MHz
Status: Populated, Enabled
Upgrade: Socket LGA1366
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: 8
Characteristics:
64-bit capable
Cache Information
Socket Designation: L1-Cache
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Through
Location: Internal
Installed Size: 256 kB
Maximum Size: 256 kB
Supported SRAM Types:
Other
Installed SRAM Type: Other
Speed: Unknown
Error Correction Type: Parity
System Type: Instruction
Associativity: 4-way Set-associative
Processor Information
Socket Designation: CPU 2
Type: Central Processor
Family: Xeon
Manufacturer: Intel
ID: C2 06 02 00 FF FB EB BF
Signature: Type 0, Family 6, Model 44, Stepping 2
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 E5620 @ 2.40GHz
Voltage: 1.2 V
External Clock: 133 MHz
Max Speed: 3600 MHz
Current Speed: 2400 MHz
Status: Populated, Enabled
Upgrade: Socket LGA1366
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: 8
Characteristics:
64-bit capable
Cache Information
Socket Designation: L1-Cache
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Through
Location: Internal
Installed Size: 256 kB
Maximum Size: 256 kB
Supported SRAM Types:
Other
Installed SRAM Type: Other
Speed: Unknown
Error Correction Type: Parity
System Type: Instruction
Associativity: 4-way Set-associative
Port Connector Information
Internal Reference Designator: Null
Internal Connector Type: None
External Reference Designator: PS2Mouse
External Connector Type: PS/2
Port Type: Mouse Port
Port Connector Information
Internal Reference Designator: Null
Internal Connector Type: None
External Reference Designator: Keyboard
External Connector Type: PS/2
Port Type: Keyboard Port
Port Connector Information
Internal Reference Designator: Null
Internal Connector Type: None
External Reference Designator: USB1
External Connector Type: Access Bus (USB)
Port Type: USB
System Slot Information
Designation: PCIE1
Type: x16 PCI Express
Current Usage: Available
Length: Short
ID: 1
Characteristics:
3.3 V is provided
Opening is shared
PME signal is supported
System Slot Information
Designation: PCIE2
Type: x4 PCI Express
Current Usage: Available
Length: Short
ID: 2
Characteristics:
3.3 V is provided
Opening is shared
PME signal is supported
On Board Device Information
Type: Video
Status: Enabled
Description: AST2050
OEM Strings
String 1: To Be Filled By O.E.M.
String 2: To Be Filled By O.E.M.
String 3: To Be Filled By O.E.M.
String 4: To Be Filled By O.E.M.
BIOS Language Information
Language Description Format: Abbreviated
Installable Languages: 1
en|US|iso8859-1
Currently Installed Language: en|US|iso8859-1
System Event Log
Area Length: 1008 bytes
Header Start Offset: 0x0810
Data Start Offset: 0x0810
Access Method: Memory-mapped physical 32-bit address
Access Address: 0xFFFBC000
Status: Valid, Not Full
Change Token: 0x00000000
Header Format: No Header
Supported Log Type Descriptors: 11
Descriptor 1: OEM-specific
Data Format 1: Multiple-event handle
Descriptor 2: OEM-specific
Data Format 2: Multiple-event handle
Descriptor 3: Single-bit ECC memory error
Data Format 3: POST results bitmap
Descriptor 4: Multi-bit ECC memory error
Data Format 4: POST results bitmap
Descriptor 5: Parity memory error
Data Format 5: Multiple-event
Descriptor 6: I/O channel block
Data Format 6: Multiple-event
Descriptor 7: POST error
Data Format 7: POST results bitmap
Descriptor 8: PCI parity error
Data Format 8: Multiple-event handle
Descriptor 9: PCI system error
Data Format 9: Multiple-event handle
Descriptor 10: System limit exceeded
Data Format 10: Multiple-event system management
Descriptor 11: OEM-specific
Data Format 11: POST results bitmap
//物理内存阵列
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: Multi-bit ECC
Maximum Capacity: 96 GB
Number Of Devices: 12
//内存阵列映射地址
Memory Array Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x000C00003FF
Range Size: 3 GB
Partition Width: 1
//内存设备
Memory Device
Total Width: 72 bits
Data Width: 79 bits
Size: 16384 MB
Form Factor: DIMM
Set: None
Locator: DIMM_A1
Bank Locator: BANK0
Type: DDR3
Type Detail: None
Speed: 1333 MHz
Manufacturer: Manufacturer00
Serial Number: D8CC0900
Asset Tag: AssetTagNum0
Part Number: TS2GKR72V3H
//内存设备映射地址
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x000000003FF
Range Size: 1 kB
Partition Row Position: 1
Interleave Position: Unknown
Interleaved Data Depth: 2
//系统引导
System Boot Information
Status: No errors detected
IPMI Device Information
Interface Type: KCS (Keyboard Control Style)
Specification Version: 2.0
I2C Slave Address: 0x10
NV Storage Device Address: 10
Base Address: 0x0000000000000CA2 (I/O)
Register Spacing: Successive Byte Boundaries