dmidecode 這款軟體允許你在 linux 系統下擷取有關硬體方面的資訊。dmidecode 遵循 smbios/dmi 标準,其輸出的資訊包括 bios、系統、主機闆、處理器、記憶體、緩存等等。偶發現這個工具很有用,就總結一下。
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), 其中包括了:
1、recode id(handle): dmi表中的記錄辨別符,這是唯一的,比如上例中的handle 0×0002。
2、dmi type id: 記錄的類型,譬如說:bios,memory,上例是type 2,即”base board information”
3、recode size: dmi表中對應記錄的大小,上例為8 bytes.(不包括文本資訊,所有實際輸出的内容比這個size要更大。)
記錄頭之後就是記錄的值:
4、decoded values: 記錄值可以是多行的,比如上例顯示了主機闆的制造商(manufacturer)、model、version以及serial number。
dmidecode的作用是将dmi資料庫中的資訊解碼,以可讀的文本方式顯示。由于dmi資訊可以人為修改,是以裡面的資訊不一定是系統準确的資訊。
安裝dmidecode
dmidecode 在主流的 linux 發行版中都可以找到,隻需通過所用發行版的包管理器安裝即可,如:
apt-get install dmidecode
# debian/ubuntu
yum install dmidecode
# rhel/centos/fedora
pacman -s dmidecode
# arch linux
emerge -av dmidecode
# gentoo
或者使用官方源碼包安裝:
dmidecode指令用法詳解
不帶選項執行 dmidecode 通常會輸出所有的硬體資訊。
dmidecode 有個很有用的選項 -t,可以按指定類型輸出相關資訊,假如要獲得處理器方面的資訊,則可以執行
dmidecode -t processor
輸出:
# dmidecode 2.10
smbios 2.6 present.
handle 0x0004, dmi type 4, 40 bytes
processor information
socket designation: cpu 1
type: central processor
family: xeon
manufacturer: intel
id: a5 06 01 00 ff fb eb bf
signature: type 0, family 6, model 26, stepping 5
flags:
fpu (floating-point unit on-chip)
vme (virtual mode extension)
de (debugging extension)
------
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
#顯示版本資訊
指令用法示例:
1、檢視伺服器型号:dmidecode | grep 'product name'
2、檢視主機闆的序列号:dmidecode |grep 'serial number'
3、檢視系統序列号:dmidecode -s system-serial-number
4、檢視記憶體資訊:dmidecode -t memory
5、檢視oem資訊:dmidecode -t 11
關于 dmidecode 的更多用法,你可以通過指定 -h 選項查詢。
dmidecode參數string及type清單
valid string keywords are:
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
valid type keywords are:
bios
system
baseboard
chassis
processor
memory
cache
connector
slot
type全部編碼清單
type information
0 bios
1 system
2 base board
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 device
如有錯誤,歡迎指正
作者:czmmiao 文章出處:http://czmmiao.iteye.com/blog/1933543