dmidecode 使用脚本

👌 2020-07-01 dmidecode 使用脚本

简介

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 参数 string 列表

  • bios-vendor
  • bios-version
  • bios-release-date
  • system-manufacturer
  • system-product-name
  • system-version
  • system-serial-number
  • system-uuid
  • system-family
  • 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

常用命令「用于生产」

  • 查看服务器型号:dmidecode -s system-product-name
  • 查看系统序列号 sn:dmidecode -s system-serial-number

查看主板的序列号:dmidecode -s baseboard-serial-number 查看内存信息:dmidecode -t memory 查看OEM信息:dmidecode -t 11

man 手册

-s, --string KEYWORD
              Only  display the value of the DMI string identified by KEYWORD.
              KEYWORD must be a keyword from the following list:  bios-vendor,
              bios-version,  bios-release-date,  system-manufacturer,  system-
              product-name, system-version, system-serial-number, system-uuid,
              system-family,  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.  Each key‐
              word corresponds to a given DMI type and a given  offset  within
              this  entry  type.   Not  all  strings may be meaningful or even
              defined on all systems. Some keywords may return more  than  one
              result  on some systems (e.g.  processor-version on a multi-pro‐
              cessor system).  If KEYWORD is not provided or not valid, a list
              of  all  valid  keywords  is printed and dmidecode exits with an
              error.  This option cannot be used more than once.
-t, --type TYPE
              Only  display the entries of type TYPE. TYPE can be either a DMI
              type number, or a comma-separated list of  type  numbers,  or  a
              keyword  from the following list: bios, system, baseboard, chas‐
              sis, processor, memory, cache, connector, slot. Refer to the DMI
              TYPES  section  below  for details.  If this option is used more
              than once, the set of displayed entries will be the union of all
              the  given  types.  If TYPE is not provided or not valid, a list
              of all valid keywords is printed and  dmidecode  exits  with  an
              error.
DMI TYPES
       The SMBIOS specification defines the following DMI types:

       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
         41   Onboard Devices Extended Information

         42   Management Controller Host Interface

       Additionally,  type 126 is used for disabled entries and type 127 is an
       end-of-table marker. Types  128  to  255  are  for  OEM-specific  data.
       dmidecode will display these entries by default, but it can only decode
       them when the vendors have contributed documentation or code for them.

       Keywords can be used instead of type numbers with --type.  Each keyword
       is equivalent to a list of type numbers:
       
       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

       Keywords  are  matched  case-insensitively. The following command lines
       are equivalent:

       · dmidecode --type 0 --type 13

       · dmidecode --type 0,13

       · dmidecode --type bios

       · dmidecode --type BIOS

参考资料

Linux命令大全