CentOSのlshwコマンドでハードウェア情報を解体せずに調査・確認

Linux

前説

自宅サーバーがそろそろ古くなってきたので買い替えようと思い、現状の筐体(ハードウェア)情報を解体せずにコマンドラインで調査してみました。
また、HDDがそろそろ耐用年数の限界に近いとか思うので、HDDの稼働時間などをSMARTで調査していきます。
環境 : CentOS Linux release 7.2.1511 (Core)

lshwコマンド

lshwコマンドのインストール

ハードウェア情報を表示するコマンド「lshw」をインストール
他にも「hwinfo」などがあるみたいです。


[root@sv01 ~]# yum -y install lshw.x86_64

インストールした内容を確認


[root@sv01 ~]# yum -y install lshw.x86_64

インストール済みパッケージ
名前                : lshw
アーキテクチャー    : x86_64
バージョン          : B.02.18
リリース            : 17.el7
容量                : 941 k
リポジトリー        : installed
提供元リポジトリー  : base
要約                : HardWare LiSter
URL                 : http://ezix.org/project/wiki/HardwareLiSter
ライセンス          : GPLv2
説明                : lshw (Hardware Lister) is a small tool to provide detailed informaton on
                    : the hardware configuration of the machine. It can report exact memory
                    : configuration, firmware version, mainboard configuration, CPU version
                    : and speed, cache configuration, bus speed, etc. on DMI-capable x86s
                    : systems and on some PowerPC machines (PowerMac G4 is known to work).
                    :
                    : Information can be output in plain text, XML or HTML.
                    :
                    : For detailed information on lshw features and usage, please see the
                    : included documentation or go to the lshw Web page,
                    : http://lshw.ezix.org/

lshwコマンドで確認

オプション「-short」を付けるとパスと要約情報が表示されて見やすいです。
※逆に「-short」を付けないと長すぎて分かりづらいです。


[root@sv01 ~]# lshw -short
H/W path         Device      Class          Description
=======================================================
                             system         HP Compaq 8000 Elite USDT PC (AU248AV)
/0                           bus            3648h
/0/1                         memory         128KiB BIOS
/0/5                         processor      Intel(R) Core(TM)2 Duo CPU     E7500  @ 2.93GHz
/0/5/6                       memory         128KiB L1 cache
/0/5/7                       memory         3MiB L2 cache
/0/3c                        memory         4GiB System Memory
/0/3c/0                      memory         2GiB DIMM DDR3 Synchronous 1333 MHz (0.8 ns)
/0/3c/1                      memory         DIMM DDR3 Synchronous [empty]
/0/3c/2                      memory         2GiB DIMM DDR3 Synchronous 1333 MHz (0.8 ns)
/0/3c/3                      memory         DIMM DDR3 Synchronous [empty]
/0/3d                        memory         Flash Memory
/0/3d/0                      memory         4MiB Chip FLASH Non-volatile
/0/100                       bridge         4 Series Chipset DRAM Controller
/0/100/2                     display        4 Series Chipset Integrated Graphics Controller
/0/100/2.1                   display        4 Series Chipset Integrated Graphics Controller
/0/100/3                     communication  4 Series Chipset HECI Controller
/0/100/3.2                   storage        4 Series Chipset PT IDER Controller
/0/100/3.3                   communication  4 Series Chipset Serial KT Controller
/0/100/19        enp0s25     network        82567LM-3 Gigabit Network Connection
/0/100/1a                    bus            82801JD/DO (ICH10 Family) USB UHCI Controller #4
/0/100/1a/1      usb3        bus            UHCI Host Controller
/0/100/1a.1                  bus            82801JD/DO (ICH10 Family) USB UHCI Controller #5
/0/100/1a.1/1    usb4        bus            UHCI Host Controller
/0/100/1a.2                  bus            82801JD/DO (ICH10 Family) USB UHCI Controller #6
/0/100/1a.2/1    usb5        bus            UHCI Host Controller
/0/100/1a.7                  bus            82801JD/DO (ICH10 Family) USB2 EHCI Controller #2
/0/100/1a.7/1    usb1        bus            EHCI Host Controller
/0/100/1b                    multimedia     82801JD/DO (ICH10 Family) HD Audio Controller
/0/100/1c                    bridge         82801JD/DO (ICH10 Family) PCI Express Port 1
/0/100/1d                    bus            82801JD/DO (ICH10 Family) USB UHCI Controller #1
/0/100/1d/1      usb6        bus            UHCI Host Controller
/0/100/1d.1                  bus            82801JD/DO (ICH10 Family) USB UHCI Controller #2
/0/100/1d.1/1    usb7        bus            UHCI Host Controller
/0/100/1d.2                  bus            82801JD/DO (ICH10 Family) USB UHCI Controller #3
/0/100/1d.2/1    usb8        bus            UHCI Host Controller
/0/100/1d.7                  bus            82801JD/DO (ICH10 Family) USB2 EHCI Controller #1
/0/100/1d.7/1    usb2        bus            EHCI Host Controller
/0/100/1e                    bridge         82801 PCI Bridge
/0/100/1f                    bridge         82801JDO (ICH10DO) LPC Interface Controller
/0/100/1f.2      scsi0       storage        82801JD/DO (ICH10 Family) SATA AHCI Controller
/0/100/1f.2/0    /dev/sda    disk           160GB ST9160412AS
/0/100/1f.2/0/1  /dev/sda1   volume         1GiB Linux filesystem partition
/0/100/1f.2/0/2  /dev/sda2   volume         9218MiB Linux LVM Physical Volume partition
/0/100/1f.2/0/3  /dev/sda3   volume         139GiB Linux LVM Physical Volume partition
/0/100/1f.2/1    /dev/cdrom  disk           DV-28S-V
/0/0                         system         PnP device PNP0c04
/0/2                         system         PnP device PNP0200
/0/3                         system         PnP device PNP0b00
/0/4                         system         PnP device PNP0800
/0/6                         input          PnP device PNP0f13
/0/7                         input          PnP device PNP0303
/0/8                         system         PnP device PNP0003
/0/9                         generic        PnP device IFX0102
/0/a                         system         PnP device PNP0103
/0/b                         system         PnP device PNP0c02
/0/c                         system         PnP device PNP0c02
/0/d                         system         PnP device PNP0c02
/0/e                         system         PnP device PNP0c01
/1                           power          Standard Efficiency

Class項目にハードウェアの項目名が記載されています。

system 筐体のモデル名が表示されます HP Compaq 8000 Elite USDT PC (AU248AV)
processor CPU情報 Intel(R) Core(TM)2 Duo CPU E7500 @ 2.93GHz
memory 4行目(/0/3c)が搭載されている物理メモリの総合計
5~8行目(/0/3c/0~/0/3c/3)が各メモリスロットルに刺されているメモリ情報
4GiB System Memory
network ethernet情報 82567LM-3 Gigabit Network Connection
disk 42行目の方がディスク情報で、その下が各ボリューム情報 /dev/sda
160GB ST9160412AS

smartmontoolsコマンド

smartmontoolsコマンドのインストール

HDDは障害や故障の予測を行うためのS.M.A.R.T.(Self-Monitoring, Analysis and Reporting Technology 以下SMART)情報を記録しています。
この情報を表示するsmartmontoolsコマンドをインストール。


[root@sv01 ~]# yum -y install smartmontools.x86_64

smartmontoolsコマンドで確認

調べたいHDDパス「/dev/sda」を変更してください


[root@sv01 ~]# smartctl -a /dev/sda
smartctl 7.0 2018-12-30 r4883 [x86_64-linux-3.10.0-327.el7.x86_64] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Momentus 7200.4
Device Model:     ST9160412AS
Serial Number:    5VG3YE06
LU WWN Device Id: 5 000c50 021c02f3e
Firmware Version: B006HPM1
User Capacity:    160,041,885,696 bytes [160 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    7200 rpm
Form Factor:      2.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA8-ACS T13/1699-D revision 4
SATA Version is:  SATA 2.6, 3.0 Gb/s
Local Time is:    Tue Jun 15 11:52:17 2021 JST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

--------------------- [ 省略 ] ---------------------

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   117   099   006    Pre-fail  Always       -       131378954
  3 Spin_Up_Time            0x0002   099   099   000    Old_age   Always       -       0
  4 Start_Stop_Count        0x0033   099   099   000    Pre-fail  Always       -       1949
  5 Reallocated_Sector_Ct   0x0033   099   099   036    Pre-fail  Always       -       22
  7 Seek_Error_Rate         0x000f   079   060   030    Pre-fail  Always       -       13184095963
  9 Power_On_Hours          0x0032   017   017   000    Old_age   Always       -       73332
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0033   099   099   020    Pre-fail  Always       -       1949
183 Runtime_Bad_Block       0x0032   100   253   000    Old_age   Always       -       0
184 End-to-End_Error        0x0033   100   100   097    Pre-fail  Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -       0
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   062   058   045    Old_age   Always       -       38 (Min/Max 20/39)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       6
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       29
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       1949
194 Temperature_Celsius     0x0022   038   042   000    Old_age   Always       -       38 (0 8 0 0 0)
195 Hardware_ECC_Recovered  0x001a   056   029   000    Old_age   Always       -       131378954
196 Reallocated_Event_Count 0x0033   099   099   036    Pre-fail  Always       -       22
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
254 Free_Fall_Sensor        0x0032   100   100   000    Old_age   Always       -       0
--------------------- [ 省略 ] ---------------------

「SMART Attributes Data Structure revision number」のID:9に「Power_On_Hours」があり列:RAW_VALUEの数値をがHDDの稼働時間(単位:Hour)になります。

まとめ

HDD稼働時間が73332時間と約8年半も頑張って動いてくれています。
HDDの寿命や耐用年数が約26,000~35,000時間と言われているので、もう交換時期を大きくオーバーしております。
5行目の「Reallocated_Sector_Ct(代替処理を受けたセクタの数)」の現在値(VALUE)が99と閾値(THRESH)の36を超えていますし交換ですね。

新ディスク

新ディスクは2.5インチHDDするかSSDにするか色々と迷いましたが、2.5インチSSDにしました。

Crucial SSD 250GB MX500

と本当は『MLC』がよかったのですが、高価なのでだったので『3D TLC NAND』で妥協しました。
別のWindowsマシンにバックアップは毎日しているので故障してもOSとミドルウェアだけ入れ直せば復旧できかなと思っています。

[更新] その他オプション

lshwコマンドのその他オプションはこちらのページで詳しく紹介されていますのでご参考ください。
「-json」とかは使えそうな感じかな。
https://atmarkit.itmedia.co.jp/ait/articles/1904/11/news023.html

コメント