Linux/Mac/Windowsでハードウェア構成に関する情報を調べる

by andreas.hopf



サーバ/クライアントPC問わず、今使っているマシンのハードウェア構成がどのようなものかをOS上で確認したくなることもあるでしょう。
そんな時にお手軽に調べられる方法を、たまーにググったりするので、Linux/Mac OS X/Windowsの3つのOSの場合の調べ方をここに残しておきます。

Linux

Linuxでは、dmidecodeコマンドを使います。
BIOSの情報とか、マシンの各種システム情報(シリアルナンバー等の各種メタ情報、CPU、メモリ、その他デバイス情報とか)が取得できます。

CentOS/RHELとかだと"kernel-utils"パッケージがインストールされていれば使えます。


ちょっと長いですが、以下のような感じです。

# dmidecode

# dmidecode 2.11
SMBIOS 2.7 present.
87 structures occupying 3996 bytes.
Table at 0x7F1FE018.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
        Vendor: FUJITSU // American Megatrends Inc.
        Version: V4.6.5.3 R2.4.0 for D3032-A1x
        Release Date: 08/10/2012
        Address: 0xF0000
        Runtime Size: 64 kB
        ROM Size: 8192 kB
        Characteristics:
                PCI is supported
                BIOS is upgradeable
                BIOS shadowing is allowed
                Boot from CD is supported
                Selectable boot is supported
                EDD is supported
                Print screen service is supported (int 5h)
                Serial services are supported (int 14h)
                Printer services are supported (int 17h)
                ACPI is supported
                USB legacy is supported
                BIOS boot specification is supported
                Targeted content distribution is supported
                UEFI is supported
        BIOS Revision: 2.4
        Firmware Revision: 6.53

Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: FUJITSU
        Product Name: PRIMERGY RX200 S7
        Version: GS03
        Serial Number: MAAQ00XXXX
        UUID: XXXXXXXX-BAE4-E111-8607-F80FXXXXXXXX
        Wake-up Type: Power Switch
        SKU Number: S26361-XXXX-Vxxx
        Family: SERVER

Handle 0x0002, DMI type 2, 15 bytes
Base Board Information
        Manufacturer: FUJITSU
        Product Name: D3032-A1
        Version: S26361-D3032-A100 WGS02 GS02
        Serial Number: 5556W01001GXXXXXXXXXXXX
        Asset Tag:
        Features:
                Board is a hosting board
                Board is replaceable
        Location In Chassis:
        Chassis Handle: 0x0003
        Type: Motherboard
        Contained Object Handles: 0

Handle 0x0003, DMI type 3, 22 bytes
Chassis Information
        Manufacturer: FUJITSU
        Type: Rack Mount Chassis
        Lock: Not Present
        Version: RX200S7R1
        Serial Number: MAAQ00XXXX
        Asset Tag: System Asset Tag
        Boot-up State: Safe
        Power Supply State: Safe
        Thermal State: Safe
        Security Status: None
        OEM Information: 0x00000000
        Height: 1 U
        Number Of Power Cords: Unspecified
        Contained Elements: 0
        SKU Number: S26361-XXXX-Vxxx

Handle 0x0004, DMI type 4, 42 bytes
Processor Information
        Socket Designation: CPU1
        Type: Central Processor
        Family: Xeon
        Manufacturer: Intel
        ID: D7 06 02 00 FF FB EB BF
        Signature: Type 0, Family 6, Model 45, Stepping 7
        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 E5-2660 0 @ 2.20GHz
        Voltage: 0.9 V
        External Clock: 100 MHz
        Max Speed: 4000 MHz
        Current Speed: 2200 MHz
        Status: Populated, Enabled
        Upgrade: Socket LGA2011
        L1 Cache Handle: 0x0005
        L2 Cache Handle: 0x0006
        L3 Cache Handle: 0x0007
        Serial Number: Not Specified
        Asset Tag: Not Specified
        Part Number: Not Specified
        Core Count: 8
        Core Enabled: 8
        Thread Count: 16
        Characteristics:
                64-bit capable
                Multi-Core
                Hardware Thread
                Execute Protection
                Enhanced Virtualization
                Power/Performance Control


・・・・・以下、長すぎるので省略・・・・・


ちなみに、dmidecodeコマンドはオプション無しで実行すると、全ての情報を出力しますが、"-s"オプションや"-t"オプションを利用すると必要な情報だけを絞り込んで出力することも可能です。
例えば「dmidecode -t memory」を実行すればメモリデバイスの情報のみが出力されます。
以下は参考までにコマンドヘルプの情報と、、、

# dmidecode --help
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
 -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

manの一部を。(-s, -tオプションの詳細)

-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,  baseboard-manufac-
    turer,  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 keyword 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-processor  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-sepa-
    rated  list  of  type  numbers, or a keyword from the following list: bios, system, baseboard,
    chassis, 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  key-
    words is printed and dmidecode exits with an error.

Mac OS X

Mac OS Xでは、system_profilerコマンドを使います。
Linuxのdmidecodeコマンドと比べて、多くの情報が取得できる印象です。

$ system_profiler
Hardware:

    Hardware Overview:

      Model Name: MacBook Air
      Model Identifier: MacBookAir3,1
      Processor Name: Intel Core 2 Duo
      Processor Speed: 1.4 GHz
      Number of Processors: 1
      Total Number of Cores: 2
      L2 Cache: 3 MB
      Memory: 4 GB
      Bus Speed: 800 MHz
      Boot ROM Version: MBA31.0061.B01
      SMC Version (system): 1.67f10
      Serial Number (system): C02DXXXXXXXX
      Hardware UUID: XXXXXXXX-2D7A-5461-8807-1A8CXXXXXXXX

・・・・・一部省略・・・・・

Graphics/Displays:
    NVIDIA GeForce 320M:
      Chipset Model: NVIDIA GeForce 320M
      Type: GPU
      Bus: PCI
      VRAM (Total): 256 MB
      Vendor: NVIDIA (0x10de)
      Device ID: 0x08a2
      Revision ID: 0x00a2
      ROM Revision: 3571
      Displays:
        Color LCD:
          Resolution: 1366 x 768
          Pixel Depth: 32-Bit Color (ARGB8888)
          Main Display: Yes
          Mirror: Off
          Online: Yes
          Built-In: Yes
          Connection Type: DisplayPort
        Display Connector:
          Status: No Display Connected
Memory:
    Memory Slots:
      ECC: Disabled
        BANK 0/DIMM0:
          Size: 2 GB
          Type: DDR3
          Speed: 1067 MHz
          Status: OK
          Manufacturer: 0x80CE
          Part Number: 0x4D34373142353237334348302D5946382020
          Serial Number: 0x00000000
        BANK 1/DIMM0:
          Size: 2 GB
          Type: DDR3
          Speed: 1067 MHz
          Status: OK
          Manufacturer: 0x80CE
          Part Number: 0x4D34373142353237334348302D5946382020
          Serial Number: 0x00000000

・・・・・以下、長すぎるので省略・・・・・

こちらもdmidecode同様、何もオプションを付けずに実行すると、全ての情報が出力されますが、"-detailLevel"のオプション指定や、DataTypeを指定することで必要な情報のみ出力することが可能です。(詳細は以下ヘルプ参照)
system_profiler -listDataTypes」を実行すると、指定可能なDataTypeの一覧が出力されます。


例えば、ディスクまわりの情報が見たいときなどは、、、

$ system_profiler SPSerialATADataType
Serial-ATA:

    NVidia MCP89 AHCI:

      Vendor: NVidia
      Product: MCP89 AHCI
      Link Speed: 3 Gigabit
      Negotiated Link Speed: 3 Gigabit
      Description: AHCI Version 1.30 Supported

        APPLE SSD TS064C:

          Capacity: 60.67 GB (60,666,413,056 bytes)
          Model: APPLE SSD TS064C                        
          Revision: CJAA0201
          Serial Number:         Y0MAXXXXXXXX
          Native Command Queuing: No
          Removable Media: No
          Detachable Drive: No
          BSD Name: disk0
          Medium Type: Solid State
          TRIM Support: Yes
          Partition Map Type: GPT (GUID Partition Table)
          S.M.A.R.T. status: Verified
          Volumes:
              Capacity: 209.7 MB (209,715,200 bytes)
              Writable: Yes
              BSD Name: disk0s1
            Macintosh HD:
              Capacity: 60.32 GB (60,322,439,168 bytes)
              Available: 24.43 GB (24,429,600,768 bytes)
              Writable: Yes
              File System: Journaled HFS+
              BSD Name: disk0s2
              Mount Point: /

こんな感じで指定してやると確認できるわけですね。


ヘルプも参考までに以下に貼っておきます。

$ system_profiler --help
Usage: system_profiler [-listDataTypes]
       system_profiler [-xml] [-detailLevel n]
       system_profiler [-xml] [dataType1 ... dataTypeN]

  -detailLevel n    specifies the level of detail for the report
                      mini = short report (contains no identifying or personal information)
                      basic = basic hardware and network information
                      full = all available information

  -listDataTypes    lists all the available datatypes

  -xml              generates xml output instead of plain text
                    if redirected to a file with the extension ".spx"
                    the file can be opened in System Profiler.app

Examples:

  system_profiler
     Generates a text report with the standard detail level.

  system_profiler -detailLevel mini
     Generates a short report without identifying/personal information.

  system_profiler -listDataTypes
     Shows a list of the available data types.

  system_profiler SPSoftwareDataType SPNetworkDataType
     Generates a text report containing only software and network data.

  system_profiler -xml >MySystem.spx
     Creates a XML file which can be opened by System Profiler.app

Windows

ビデオチップの種類やビデオメモリ容量を調べたくなった場合(Windows) - 元RX-7乗りの適当な日々ここで書いていました(^^)

Windows OSでは、[Windows]キー + [R]を押して、「ファイル名を指定して実行」のウインドウで、dxdiagと入力するとDirectX診断ツールといったユーティリティが起動し、このソフトから様々なデバイス情報を確認することができます。(コントロールパネルのシステム情報より詳細に取得できてるんじゃないかな。)


https://farm4.static.flickr.com/3056/2800511110_db11029959_o.png

https://farm4.static.flickr.com/3049/2799663943_996475a98e_o.png

こちらは、GUIでの操作ということもあって、特に説明は要らないですねw

追記

コメントにて、「msinfo32.exe」を教えていただきました(↑同様「ファイル名を指定して実行」から実行)。確かにコチラのほうが情報量が多く確認できますね。ありがとうございました!



こんな感じで、各種3つのOSから簡単にシステム情報を確認する方法を書き残してみました。

もっと細かく見たいときやスクリプト等で必要な情報を綺麗に取りだしたい時などは、別途ツールをインストールすればよいのですが、まずはお手軽にチェックする方法を、ってことで(^^;)

それでは! =͟͟͞͞(๑•̀=͟͟͞͞(๑•̀д•́=͟͟͞͞(๑•̀д•́๑)=͟͟͞͞(๑•̀д•́


Linuxエンジニア養成読本 [仕事で使うための必須知識&ノウハウ満載!] (Software Design plus)

Linuxエンジニア養成読本 [仕事で使うための必須知識&ノウハウ満載!] (Software Design plus)

Linuxの教科書 改訂版 (マイコミムック) (MYCOMムック)

Linuxの教科書 改訂版 (マイコミムック) (MYCOMムック)

  • 作者: 高町健一郎,大津真,佐藤竜一,小林峰子,安田幸弘
  • 出版社/メーカー: 毎日コミュニケーションズ
  • 発売日: 2011/03/31
  • メディア: ムック
  • 購入: 13人 クリック: 63回
  • この商品を含むブログ (17件) を見る