天天看點

Dmidecode詳解

Dmidecode指令詳解

Dmidecode 這款軟體允許你在 Linux 系統下擷取有關硬體方面的資訊。Dmidecode 遵循 SMBIOS/DMI 标準,其輸出的資訊包括 BIOS、系統、主機闆、處理器、記憶體、緩存等等。

一、Dmidecode簡介

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的輸出格式一般如下:

Handle 0×0002 DMI type 2,8 bytes Base Board Information Manufacturer:Intel Product Name: C440GX+ Version: 727281-0001 Serial Number: INCY92700942

其中的前三行都稱為記錄頭(recoce Header), 其中包括了:

recode id(handle): DMI表中的記錄辨別符,這是唯一的,比如上例中的Handle 0×0002。

dmi type id: 記錄的類型,譬如說:BIOS,Memory,上例是type 2,即”Base Board Information”

recode size: DMI表中對應記錄的大小,上例為8 bytes.(不包括文本資訊,所有實際輸出的内容比這個size要更大。)記錄頭之後就是記錄的值

decoded values: 記錄值可以是多行的,比如上例顯示了主機闆的制造商(manufacturer)、model、version以及serial Number。

二、Dmidecode的作用

dmidecode的作用是将DMI資料庫中的資訊解碼,以可讀的文本方式顯示。由于DMI資訊可以人為修改,是以裡面的資訊不一定是系統準确的資訊。

三、安裝Dmidecode

Dmidecode 在主流的 Linux 發行版中都可以找到,隻需通過所用發行版的包管理器安裝即可,如:

apt-get install dmidecode

或者使用官方包安裝:

四、dmidecode指令用法詳解

不帶選項執行 dmidecode 通常會輸出所有的硬體資訊。Dmidecode 有個很有用的選項 -t,可以按指定類型輸出相關資訊,假如要獲得處理器方面的資訊,則可以執行

dmidecode -t processor

輸出:

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

隻顯示指定DMI字元串的資訊

-t, --type TYPE Only display the entries of given type

隻顯示指定條目的資訊

-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

-V, --version Display the version and exit

顯示版本資訊

五、dmidecode參數string及type清單

(1)Valid string keywords are:-s

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-version

chassis-serial-number

chassis-asset-tag

processor-family

processor-manufacturer

processor-version

processor-frequency

(2)Valid type keywords are:-t

bios

system

baseboard

chassis

processor

memory

Cache

connector

slot

(3)type全部編碼清單 //示例dmidecode -t 4 

通過man dmidecode 檢視

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

(4)string和type對應關系

Keyword Types

──────────────────────────────

bios 0, 13

system 1, 12, 15, 23, 32

baseboard 2, 10, 41

chassis 3

processor 4

memory 5, 6, 16, 17

cache 7

connector 8

slot 9

六、指令用法示例

檢視伺服器型号:dmidecode | grep 'Product Name'

檢視主機闆的序列号:dmidecode |grep 'Serial Number'

檢視系統序列号:dmidecode -s system-serial-number

檢視記憶體資訊:dmidecode -t memory

檢視OEM資訊:dmidecode -t 11

檢視廠商産品:dmidecode -t 1 

本文轉自MT_IT51CTO部落格,原文連結:http://blog.51cto.com/hmtk520/2052041,如需轉載請自行聯系原作者