使用dmidecode在Linux下获取硬件信息
dmidecode命令可以让你在Linux系统下获取有关硬件方面的信息。dmidecode的作用是将DMI数据库中的信息解码,以可读的文本方式显示。由于DMI信息可以人为修改,因此里面的信息不一定是系统准确的信息。dmidecode遵循SMBIOS/DMI标准,其输出的信息包括BIOS、系统、主板、处理器、内存、缓存等等。
DMI(Desktop Management Interface,DMI)就是帮助收集电脑系统信息的管理系统,DMI信息的收集必须在严格遵照SMBIOS规范的前提下进行。SMBIOS(System Management BIOS)是主板或系统制造者以标准格式显示产品管理信息所需遵循的统一规范。SMBIOS和DMI是由行业指导机构Desktop Management Task Force(DMTF)起草的开放性的技术标准,其中DMI设计适用于任何的平台和操作系统。
DMI充当了管理工具和系统层之间接口的角色。它建立了标准的可管理系统更加方便了电脑厂商和用户对系统的了解。DMI的主要组成部分是Management Information Format(MIF)数据库。这个数据库包括了所有有关电脑系统和配件的信息。通过DMI,用户可以获取序列号、电脑厂商、串口信息以及其它系统配件信息。
语法
dmidecode [选项]
选项
-d,-DEV MEM文件从设备文件读取内存(默认值:/DEV/MEM)
-h,帮助显示此帮助文本并退出
-Q,安静较少的冗长输出
-s,-string关键字只显示给定的DMI字符串的值
-t,-Type类型只显示给定类型的条目
-U,-转储不解码条目
——转储文件将DMI数据转储到二进制文件中。
——从转储文件读取二进制文件中的DMI数据
-V,-版本显示版本和退出
其实以上数值就是通过dmidecode命令来实现的,具体方法如下:
dmidecode以一种可读的方式dump出机器的DMI(Desktop Management Interface)信息。这些信息包括了硬件以及BIOS,既可以得到当前的配置,也可以得到系统支持的最大配置,比如说支持的最大内存数等。
DMI有人也叫SMBIOS(System Management BIOS),这两个标准都由DMTF(Desktop Management Task Force)开发。
实例:
显示全部dmi信息:
[root@localhost ~]# dmidecode
# dmidecode 2.12
SMBIOS 2.7 present.
......
......
Handle 0x0020, DMI type 127, 4 bytes
End Of Table
更精简的信息显示:
[root@localhost ~]# dmidecode -q
显示指定类型的信息:
通常我只想查看某类型,比如CPU,内存或者磁盘的信息而不是全部的。这可以使用-t(--type TYPE)来指定信息类型:
[root@localhost ~]# dmidecode -t bios
[root@localhost ~]# dmidecode -t 0,4
dmidecode支持的类型:
Type Information
--------------------------------------------
0 BIOS
1 System
2 Baseboard
3 Chassis
4 Processor
5 Memory Controller
6 Memory Module
7 Cache
8 Port Connector
通过关键字查看信息:
比如只想查看序列号,可以使用:
[root@localhost ~]# dmidecode -s system-serial-number
-s (--string keyword)支持的keyword包括:
bios-vendor, bios-version,bios-release-date, system-manufacturer, system-product-name, system-version, system-serial-number, system-uuid, baseboard-manufacturer,baseboard-product-name, baseboard-version, baseboard-serial-number,baseboard-asset-tag, chassis-manufacturer, chassis-type, chassis-ver-sion, chassis-serial-number, chassis-asset-tag, processor-family, pro-cessor-manufacturer, processor-version, processor-frequency.
查看当前内存和支持的最大内存:
Linux下,可以使用free或者查看meminfo来获得当前的物理内存:
[root@localhost ~]# free -m
total used free shared buffers cached
Mem: 32053 436 31617 0 8 55
-/+ buffers/cache: 371 31681
Swap: 7999 0 7999
这里显示了当前服务器的物理内存是32GB。
服务器到底能扩展到多大的内存?,可以使用下面的命令来查看:
[root@localhost ~]# dmidecode -t 16
# dmidecode 2.12
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: Single-bit ECC
Maximum Capacity: 768 GB (可扩展768G)
Error Information Handle: Not Provided
Number Of Devices: 12
但是,事实不一定如此,因此插槽可能已经插满了。也就是我们还必须查清这里的32G到底是4*8GB, 2*16GB还是其他?
如果是4*8GB,那么尽管可以扩展到768GB,但是插槽已经插满,无法扩展了:
[root@localhost ~]# dmidecode -t 17
- # dmidecode 2.12
- SMBIOS 2.7 present.
- Handle 0x0008, DMI type , bytes
- Memory Device
- Array Handle: 0x0007
- Error Information Handle: Not Provided
- Total Width: bits
- Data Width: bits
- Size: MB
- Form Factor: DIMM
- Set: None
- Locator: DIMM010
- Bank Locator: BRANCH CHANNEL DIMM
- Type: DDR3
- Type Detail: Synchronous Registered (Buffered)
- Speed: MHz
- Manufacturer: Hynix
- Serial Number: 0x37161DC3
- Asset Tag: Unknown
- Part Number: HMT42GR7CMR4A-G7
- Rank:
- Configured Clock Speed: MHz
- Handle 0x0009, DMI type , bytes
- Memory Device
- Array Handle: 0x0007
- Error Information Handle: Not Provided
- Total Width: Unknown
- Data Width: Unknown
- Size: No Module Installed
- Form Factor: DIMM
- Set: None
- Locator: DIMM011
- Bank Locator: BRANCH CHANNEL DIMM
- Type: DDR3
- Type Detail: Synchronous
- Speed: Unknown
- Manufacturer: NO DIMM
- Serial Number: NO DIMM
- Asset Tag: NO DIMM
- Part Number: NO DIMM
- Rank: Unknown
- Configured Clock Speed: Unknown
- Handle 0x000A, DMI type , bytes
- Memory Device
- Array Handle: 0x0007
- Error Information Handle: Not Provided
- Total Width: Unknown
- Data Width: Unknown
- Size: No Module Installed
- Form Factor: DIMM
- Set: None
- Locator: DIMM020
- Bank Locator: BRANCH CHANNEL DIMM
- Type: DDR3
- Type Detail: Synchronous
- Speed: Unknown
- Manufacturer: NO DIMM
- Serial Number: NO DIMM
- Asset Tag: NO DIMM
- Part Number: NO DIMM
- Rank: Unknown
- Configured Clock Speed: Unknown
- Handle 0x000B, DMI type , bytes
- Memory Device
- Array Handle: 0x0007
- Error Information Handle: Not Provided
- Total Width: Unknown
- Data Width: Unknown
- Size: No Module Installed
- Form Factor: DIMM
- Set: None
- Locator: DIMM021
- Bank Locator: BRANCH CHANNEL DIMM
- Type: DDR3
- Type Detail: Synchronous
- Speed: Unknown
- Manufacturer: NO DIMM
- Serial Number: NO DIMM
- Asset Tag: NO DIMM
- Part Number: NO DIMM
- Rank: Unknown
- Configured Clock Speed: Unknown
- Handle 0x000C, DMI type , bytes
- Memory Device
- Array Handle: 0x0007
- Error Information Handle: Not Provided
- Total Width: Unknown
- Data Width: Unknown
- Size: No Module Installed
- Form Factor: DIMM
- Set: None
- Locator: DIMM030
- Bank Locator: BRANCH CHANNEL DIMM
- Type: DDR3
- Type Detail: Synchronous
- Speed: Unknown
- Manufacturer: NO DIMM
- Serial Number: NO DIMM
- Asset Tag: NO DIMM
- Part Number: NO DIMM
- Rank: Unknown
- Configured Clock Speed: Unknown
- Handle 0x000D, DMI type , bytes
- Memory Device
- Array Handle: 0x0007
- Error Information Handle: Not Provided
- Total Width: Unknown
- Data Width: Unknown
- Size: No Module Installed
- Form Factor: DIMM
- Set: None
- Locator: DIMM031
- Bank Locator: BRANCH CHANNEL DIMM
- Type: DDR3
- Type Detail: Synchronous
- Speed: Unknown
- Manufacturer: NO DIMM
- Serial Number: NO DIMM
- Asset Tag: NO DIMM
- Part Number: NO DIMM
- Rank: Unknown
- Configured Clock Speed: Unknown
- Handle 0x000E, DMI type , bytes
- Memory Device
- Array Handle: 0x0007
- Error Information Handle: Not Provided
- Total Width: bits
- Data Width: bits
- Size: MB
- Form Factor: DIMM
- Set: None
- Locator: DIMM110
- Bank Locator: BRANCH CHANNEL DIMM
- Type: DDR3
- Type Detail: Synchronous Registered (Buffered)
- Speed: MHz
- Manufacturer: Hynix
- Serial Number: 0x37A61E5F
- Asset Tag: Unknown
- Part Number: HMT42GR7CMR4A-G7
- Rank:
- Configured Clock Speed: MHz
- Handle 0x000F, DMI type , bytes
- Memory Device
- Array Handle: 0x0007
- Error Information Handle: Not Provided
- Total Width: Unknown
- Data Width: Unknown
- Size: No Module Installed
- Form Factor: DIMM
- Set: None
- Locator: DIMM111
- Bank Locator: BRANCH CHANNEL DIMM
- Type: DDR3
- Type Detail: Synchronous
- Speed: Unknown
- Manufacturer: NO DIMM
- Serial Number: NO DIMM
- Asset Tag: NO DIMM
- Part Number: NO DIMM
- Rank: Unknown
- Configured Clock Speed: Unknown
- Handle 0x0010, DMI type , bytes
- Memory Device
- Array Handle: 0x0007
- Error Information Handle: Not Provided
- Total Width: Unknown
- Data Width: Unknown
- Size: No Module Installed
- Form Factor: DIMM
- Set: None
- Locator: DIMM120
- Bank Locator: BRANCH CHANNEL DIMM
- Type: DDR3
- Type Detail: Synchronous
- Speed: Unknown
- Manufacturer: NO DIMM
- Serial Number: NO DIMM
- Asset Tag: NO DIMM
- Part Number: NO DIMM
- Rank: Unknown
- Configured Clock Speed: Unknown
- Handle 0x0011, DMI type , bytes
- Memory Device
- Array Handle: 0x0007
- Error Information Handle: Not Provided
- Total Width: Unknown
- Data Width: Unknown
- Size: No Module Installed
- Form Factor: DIMM
- Set: None
- Locator: DIMM121
- Bank Locator: BRANCH CHANNEL DIMM
- Type: DDR3
- Type Detail: Synchronous
- Speed: Unknown
- Manufacturer: NO DIMM
- Serial Number: NO DIMM
- Asset Tag: NO DIMM
- Part Number: NO DIMM
- Rank: Unknown
- Configured Clock Speed: Unknown
- Handle 0x0012, DMI type , bytes
- Memory Device
- Array Handle: 0x0007
- Error Information Handle: Not Provided
- Total Width: Unknown
- Data Width: Unknown
- Size: No Module Installed
- Form Factor: DIMM
- Set: None
- Locator: DIMM130
- Bank Locator: BRANCH CHANNEL DIMM
- Type: DDR3
- Type Detail: Synchronous
- Speed: Unknown
- Manufacturer: NO DIMM
- Serial Number: NO DIMM
- Asset Tag: NO DIMM
- Part Number: NO DIMM
- Rank: Unknown
- Configured Clock Speed: Unknown
- Handle 0x0013, DMI type , bytes
- Memory Device
- Array Handle: 0x0007
- Error Information Handle: Not Provided
- Total Width: Unknown
- Data Width: Unknown
- Size: No Module Installed
- Form Factor: DIMM
- Set: None
- Locator: DIMM131
- Bank Locator: BRANCH CHANNEL DIMM
- Type: DDR3
- Type Detail: Synchronous
- Speed: Unknown
- Manufacturer: NO DIMM
- Serial Number: NO DIMM
- Asset Tag: NO DIMM
- Part Number: NO DIMM
- Rank: Unknown
- Configured Clock Speed: Unknown
根据上面输出可以发现,如果要扩展,只有将上面的内存条换成64GB的,才能达到12*64GB=768GB的最大支持内存。
附录:
dmidecode支持的数字参数:
Type Information
--------------------------------------------
0 BIOS
1 System
2 Baseboard
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
40 Additional Information
41 Onboard Devices Extended Information
42 Management Controller Host Interface
使用dmidecode在Linux下获取硬件信息的更多相关文章
- linux下获取服务器硬件信息的脚本
这是个简单的脚本,便于查询服务器的硬件信息: #!/bin/bash # # Description: # Used to get the hardware config information. # ...
- Linux下查看硬件信息的方法
用硬件检测程序kuduz探测新硬件:service kudzu start ( or restart) 查看CPU信息:cat /proc/cpuinfo 查看板卡信息:cat /proc/pci 查 ...
- linux 下查看硬件信息(mac,IP地址,硬盘型号,序列号等)
一.查看网卡mac地址 #安装lshw [root@server ~]# yum install lshw #使用方法 [root@rsync-server ~]# lshw -c network * ...
- C/C++应用--Window下获取硬件信息(CPU, 硬盘,网卡等)
一.头文件如下: #include <Windows.h> #include <string> #include <iostream> #include <w ...
- linux下dmidecode命令获取硬件信息
linux下dmidecode命令获取硬件信息 2 A+ 所属分类:Linux 运维工具 dmidecode在 Linux 系统下获取有关硬件方面的信息.dmidecode 遵循 SMBIOS/DMI ...
- Linux 系统下查看硬件信息命令大全
有许多命令可以用来查看 Linux 系统上的硬件信息.有些命令只能够打印出像 CPU 和内存这一特定的硬件组件信息,另外一些命令可以查看多种硬件组件的信息. 这个教程可以带大家快速了解一下查看各种硬件 ...
- Linux下查看CPU信息、机器型号等硬件信息命令
Linux下查看CPU信息.机器型号等硬件信息命令 编写一个bash脚本: vim info.sh #!/bin/bash cat /etc/issue echo "____________ ...
- .net core在Linux下获取AD域信息
.net core在Linux下获取AD域信息 .net Core 2.1.4 .net core现在System.DirectoryServices只支持Windows平台下使用. 参考: http ...
- Linux下获取硬盘使用情况
Linux下获取硬盘使用情况[总结] 1.前言 在嵌入式设备中,硬盘空间非常有限,在涉及到经常写日志的进程时候,需要考虑日志的大小和删除,不然很快就硬盘写满,导致日志程序崩溃.为了捕获硬盘写满的异常场 ...
随机推荐
- Nginx 405 not allowed最简单快速解决办法
Apache.IIS.Nginx等绝大多数web服务器,都不允许静态文件响应POST请求,否则会返回“HTTP/1.1 405 Method not allowed”错误. server { list ...
- ZK的选举算法
一.前言 前面学习了Zookeeper服务端的相关细节,其中对于集群启动而言,很重要的一部分就是Leader选举,接着就开始深入学习Leader选举. 二.Leader选举 2.1 Leader选举概 ...
- [題解]luogu_P1144最短路計數
1.無權圖最短路邊權為1 2.如果兩個點恰好不能被更新(d[y]==d[x]+1)那麼就能通過x的所有最短路到達y,所以ans[y]+=ans[x] 3.如果兩個點不能恰好被更新(d[y]>d[ ...
- 【aspnetcore】模拟中间件处理请求的管道
几个核心对象: ApplicationBuilder 就是startup->Configure方法的第一个参数,请求(HttpContext) 就是由这个类来处理的 HttpContext 这个 ...
- php中3DES加密技术
因为工作中要用到加密,接口中要求也是用密文传输数据,用到3des加密,就研究了一下. 在网上也找了好多,但是都不可以用,没法正式运行,终于找到一个可以运行的,自己又修改了一下,记录下来,以后还可能会用 ...
- Solr6+IKAnalyzer分词环境搭建
环境要求 Zookeeper版本:zookeeper-3.4.8 JDK版本: jdk1.8. Solr版本:solr-6.4.1 Tomcat版本:tomcat8 ZK地址:127.0.0.1:21 ...
- Java编程基础-变量
1.变量的定义. 变量与常量相对应,变量是在程序运行过程中它的值允许改变的量,变量可以通过变量名访问. 2.Java中的三大变量 (1).类变量.又称为静态变量,在类中定义类的属性时,使用static ...
- Volley源码解析(三) 有缓存机制的情况走缓存请求的源码分析
Volley源码解析(三) 有缓存机制的情况走缓存请求的源码分析 Volley之所以高效好用,一个在于请求重试策略,一个就在于请求结果缓存. 通过上一篇文章http://www.cnblogs.com ...
- Android项目中包名的修改
通常修改包名时会造成R文件错误,并且有时带有原因不明的Manifest文件中多处文本混乱. 所以,将目前认为最为简洁方便的修改包名流程记录如下: 假设我们目前的包名为com.pepper.util,我 ...
- 分布式系统中的CAP原理和BASE理论
CAP是一致性(Consistency).可用性(Availability).分区容忍性(Partition tolerance)的缩写.CAP原理指的是这三个要素最多只能同时实现两点,不可能三者兼顾 ...