用 smartmontools 檢查硬碟狀態

偶然有機會用到這個 smartmontools 工具,覺得蠻值得筆記一下,它可以檢查硬碟的健康狀態。 先直接安裝一下 smartmontools 工具:

[root@liho ~]# dnf install smartmontools -y
Last metadata expiration check: 0:41:10 ago on Mon 25 Dec 2023 08:59:32 AM CST.
Dependencies resolved.
==================================================================================================================================================
 Package                               Architecture                   Version                                Repository                      Size
==================================================================================================================================================
Installing:
 smartmontools                         x86_64                         1:7.2-7.el9                            baseos                         548 k

Transaction Summary
==================================================================================================================================================
Install  1 Package

Total download size: 548 k
Installed size: 1.9 M
Downloading Packages:
smartmontools-7.2-7.el9.x86_64.rpm                                                                                5.6 MB/s | 548 kB     00:00
--------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                             943 kB/s | 548 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                          1/1
  Installing       : smartmontools-1:7.2-7.el9.x86_64                                                                                         1/1
  Running scriptlet: smartmontools-1:7.2-7.el9.x86_64                                                                                         1/1
Created symlink /etc/systemd/system/multi-user.target.wants/smartd.service → /usr/lib/systemd/system/smartd.service.

  Verifying        : smartmontools-1:7.2-7.el9.x86_64                                                                                         1/1

Installed:
  smartmontools-1:7.2-7.el9.x86_64

Complete!

然後使用 smartctl 指令檢查狀態:

[root@liho ~]# smartctl -a /dev/sdg
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.14.0-284.11.1.el9_2.x86_64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Vendor:               HPE
Product:              MB018000JYCLK
Revision:             HPD3
Compliance:           SPC-4
User Capacity:        18,000,207,937,536 bytes [18.0 TB]
Logical block size:   512 bytes
Physical block size:  4096 bytes
Rotation Rate:        7200 rpm
Form Factor:          3.5 inches
Logical Unit id:      0x5000039cd801d179
Serial number:        XXXXXXXXXXXX
Device type:          disk
Transport protocol:   SAS (SPL-3)
Local Time is:        Mon Dec 25 09:41:50 2023 CST
SMART support is:     Available - device has SMART capability.
SMART support is:     Enabled
Temperature Warning:  Enabled

=== START OF READ SMART DATA SECTION ===
SMART Health Status: OK

Current Drive Temperature:     26 C
Drive Trip Temperature:        60 C

Accumulated power on time, hours:minutes 259:50
Manufactured in week 40 of year 2023
Specified cycle count over device lifetime:  50000
Accumulated start-stop cycles:  71
Specified load-unload count over device lifetime:  600000
Accumulated load-unload cycles:  71
Elements in grown defect list: 0

Error counter log:
           Errors Corrected by           Total   Correction     Gigabytes    Total
               ECC          rereads/    errors   algorithm      processed    uncorrected
           fast | delayed   rewrites  corrected  invocations   [10^9 bytes]  errors
read:          0       48         0         0          0      69548.551           0
write:         0       15         0         0          0      58096.019           0
verify:        0        0         0         0          0          0.008           0

Non-medium error count:        0

No Self-tests have been logged

這顆硬碟剛好有延遲錯誤