smartmontools on macOS Mojave
更新履歴
- 2021.02.15
はじめに
- このドキュメントでは,HomeBrewを使ってsmartmontoolsをインストールし,ストレージのS.M.A.R.T.値を確認する.
ショートカット
- 知っている人専用.
目的 |
コマンド |
---|---|
デバイス調査 |
df -h |
情報検索 |
smartctl -i /dev/disk1s1 |
デバイス利用状況の表示 |
smartctl -A /dev/disk1s1 |
自己診断short |
smartctl -t short /dev/disk1s1 |
自己診断long |
smartctl -t long /dev/disk1s1 |
レポートの表示 |
|
パッケージ確認
- brewでパッケージ確認.
$ brew info smartmontools🆑
smartmontools: stable 7.2 (bottled)
SMART hard drive monitoring
https://www.smartmontools.org/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/smartmontools.rb
License: GPL-2.0-or-later
==> Analytics
install: 30,658 (30 days), 36,157 (90 days), 48,992 (365 days)
install-on-request: 30,458 (30 days), 35,601 (90 days), 46,982 (365 days)
build-error: 0 (30 days)
[macmini2014:ujpadmin 09:22:53 ~ ]
$
- よくインストールされている模様.
インストール
- 早速インストール
$ brew install smartmontools🆑
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/core, homebrew/cask and homebrew/services).
==> New Formulae
crispy-doom
go@1.15
name-that-hash
pcalc
rdkit
waffle
ghc@9
kubergrunt
open-adventure
projectm
saml2aws
yubikey-agent
==> Updated Formulae
Updated 1148 formulae.
==> Deleted Formulae
avian
geant4
==> New Casks
bleunlock
font-smoothing-adjuster
nault
the-archive
bluesnooze
infinity
pika
wannianli
cinco
kiwi-for-gmail
redream
xournal-plus-plus
cog
kyokan-bob
rhino
zecwallet-lite
fawkes
megax
textbuddy
zulufx
==> Updated Casks
Updated 385 casks.
==> Deleted Casks
kode54-cog
protonmail-unofficial
yyets
mega
rhinoceros
==> Downloading https://homebrew.bintray.com/bottles/smartmontools-7.2.mojave.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/3f699e7deb392d47d805cf4dad81e53cf67fe0186b00f42
######################################################################## 100.0%
==> Pouring smartmontools-7.2.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/smartmontools/7.2: 36 files, 1.9MB🈁
[macmini2014:ujpadmin 09:23:41 ~ ]
$
- インストールで何が入ったか確認.
$ ls -la /usr/local/Cellar/smartmontools/7.2🆑
total 108
drwxr-xr-x 13 ujpadmin admin 416 3 2 09:23 .
drwxr-xr-x 3 ujpadmin admin 96 3 2 09:23 ..
drwxr-xr-x 4 ujpadmin admin 128 12 31 01:49 .bottle
drwxr-xr-x 3 ujpadmin admin 96 12 31 01:49 .brew
-rw-r--r-- 1 ujpadmin admin 2020 12 31 01:49 AUTHORS
-rw-r--r-- 1 ujpadmin admin 18092 12 31 01:49 COPYING
-rw-r--r-- 1 ujpadmin admin 30967 12 31 01:49 ChangeLog
-rw-r--r-- 1 ujpadmin admin 1004 3 2 09:23 INSTALL_RECEIPT.json
-rw-r--r-- 1 ujpadmin admin 37606 3 2 09:23 NEWS
-rw-r--r-- 1 ujpadmin admin 2995 12 31 01:49 README
-rw-r--r-- 1 ujpadmin admin 151 12 31 01:49 TODO
drwxr-xr-x 5 ujpadmin admin 160 3 2 09:23 bin🈁
drwxr-xr-x 5 ujpadmin admin 160 12 31 01:49 share
[macmini2014:ujpadmin 09:27:42 ~ ]
$
- ディレィトリは以下のモジュールを確認する.
$ ls -la /usr/local/Cellar/smartmontools/7.2/bin/🆑
total 1140
drwxr-xr-x 5 ujpadmin admin 160 3 2 09:23 .
drwxr-xr-x 13 ujpadmin admin 416 3 2 09:23 ..
-r-xr-xr-x 1 ujpadmin admin 650600 12 31 01:49 smartctl🈁
-r-xr-xr-x 1 ujpadmin admin 488656 12 31 01:49 smartd🈁
-r-xr-xr-x 1 ujpadmin admin 23952 3 2 09:23 update-smart-drivedb🈁
[macmini2014:ujpadmin 09:27:50 ~ ]
$
- モジュールが配置されていることが確認できた.
検査対象のデバイスを確認する
- オプションに--scanをつけて実行.
$ smartctl --scan🆑
IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,
2/AppleIntelPchSeriesAHCI/PRT0@0/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice
-d ata # IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@1F,
2/AppleIntelPchSeriesAHCI/PRT0@0/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice,
ATA device
[macmini2014:ujpadmin 09:29:20 ~ ]
$
- ちょっとよくわからない...
- 普通のデバイス名を確認.
$ df -h🆑
Filesystem Size Used Avail Use% Mounted on
/dev/disk1s1 477G 284G 185G 61% /🈁
/dev/disk1s4 477G 8.1G 185G 5% /private/var/vm
[macmini2014:ujpadmin 09:32:18 ~ ]
$
- vmファイルは仮想記憶デバイスなので検査対象外.
- disk1s1このデバイス名を使用する.
デバイス名を指定して基本情報を取得
- smartctlに,-iをつけて情報を取得.
$ smartctl -i /dev/disk1s1🆑
smartctl 7.2 2020-12-30 r5155 [Darwin 18.7.0 x86_64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Device Model: TOSHIBA THNSNH512GCST🈁
Serial Number: 33JS103OTXXX
LU WWN Device Id: 5 00080d b00018cec
Firmware Version: HTSAN104
User Capacity: 512,110,190,592 bytes [512 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
Form Factor: 2.5 inches
TRIM Command: Available, deterministic, zeroed
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ACS-2 (minor revision not indicated)
SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Tue Mar 2 09:32:43 2021 JST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled🈁
[macmini2014:ujpadmin 09:32:43 ~ ]
$
- 東芝のデバイスの模様.
- SMART SupportがEnabledなので対応している模様.
デバイスの使用状況を確認する
- smartctl -Aオプションを使って全ての情報を表示させる.
$ smartctl -A /dev/disk1s1🆑
smartctl 7.2 2020-12-30 r5155 [Darwin 18.7.0 x86_64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME
FLAG VALUE WORST THRESH
TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000a
100 100 000
Old_age Always
- 0
2 Throughput_Performance 0x0005 100
100 050 Pre-fail
Offline
- 0
3
Spin_Up_Time
0x0007 100 100
050 Pre-fail
Always
- 0
5 Reallocated_Sector_Ct 0x0013
100 100 050 Pre-fail
Always
- 0
7 Unknown_SSD_Attribute 0x000b
100 100 050 Pre-fail
Always
- 0
8 Unknown_SSD_Attribute 0x0005
100 100 050 Pre-fail
Offline
- 0
9
Power_On_Hours
0x0012 100 100 000
Old_age Always
- 870
10 Unknown_SSD_Attribute 0x0013
100 100 050 Pre-fail
Always
- 0
12 Power_Cycle_Count
0x0012 100 100 000
Old_age Always
- 29172🈁
167 Unknown_Attribute
0x0022 100 100 000
Old_age Always
- 0
168 Unknown_Attribute
0x0012 100 100 000
Old_age Always
- 0
169 Unknown_Attribute
0x0013 100 100 010
Pre-fail Always
- 100
170 Unknown_Attribute
0x0013 100 100 010
Pre-fail Always
- 0
173 Unknown_Attribute
0x0012 187 187 000
Old_age Always
- 0
175 Program_Fail_Count_Chip 0x0013 100
100 010 Pre-fail
Always
- 0
192 Power-Off_Retract_Count 0x0012 100
100 000 Old_age
Always
- 10
194 Temperature_Celsius 0x0022
071 052 000
Old_age Always
- 29 (Min/Max 17/48)
197 Current_Pending_Sector 0x0012 100
100 000 Old_age
Always
- 0
240 Unknown_SSD_Attribute 0x0013 100
100 050 Pre-fail
Always
- 0
[macmini2014:ujpadmin 09:35:50 ~ ]
$
- Power_On_Hoursは,デバイスの電源ON状態の関さん時間.830時間か.24h365dで計算すると2.3年.
- Power_Cycle_Countが多いな.ファームウェアが電源ON/OFFした回数.省電力状態が多いと上がりそう.
対応しているテスト項目を調べる
- デバイスによって対応しているテスト項目が違うようなので,今回の試験対象デバイスの値を確認してみる.
$ smartctl -c /dev/disk1s1🆑
smartctl 7.2 2020-12-30 r5155 [Darwin 18.7.0 x86_64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
was never started.
Auto Offline Data Collection:
Disabled.
Self-test execution status: (
0) The previous self-test routine completed
without error or no self-test has
ever
been run.
Total time to complete Offline
data collection: ( 120) seconds.
Offline data collection
capabilities: (0x5b) SMART execute Offline immediate.
Auto Offline data collection
on/off support.
Suspend Offline collection upon
new
command.
Offline surface scan supported.
Self-test supported.
No Conveyance Self-test supported.
Selective Self-test supported.
SMART
capabilities:
(0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine🈁
recommended polling time: ( 2) minutes.
Extended self-test routine🈁
recommended polling time: ( 27) minutes.
SCT capabilities: (0x0039) SCT Status supported.
SCT Error Recovery Control
supported.
SCT Feature Control supported.
SCT Data Table supported.
[macmini2014:ujpadmin 14:42:38 ~ ]
$
- 現在のストレージが対応しているテストは,shortが2分,Extendedが27分.
- 場合によってはConveyanceというものがある模様.
自己診断の実行(short)
- 短い方のテストを実行する.
$ smartctl -t short /dev/disk1s1🆑
smartctl 7.2 2020-12-30 r5155 [Darwin 18.7.0 x86_64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Short self-test routine immediately in off-line mode".
Drive command "Execute SMART Short self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 2 minutes for test to complete.🆑
Test will complete after Tue Mar 2 09:49:27 2021 JST
Use smartctl -X to abort test.
[macmini2014:ujpadmin 09:47:27 ~ ]
$
翻訳説明
コマンドを送信します。"オフラインモードですぐに SMART Short セルフテストルーチンを実行してください。
ドライブコマンド「オフラインモードですぐにSMART Shortセルフテストルーチンを実行してください」成功。
テストを開始しました。
テストが完了するまで 2 分間お待ちください。
テストは Tue Mar 2 09:49:27 2021 JST の後に終了します。
テストを中止するには smartctl -X を使用します。
- 2分経過したのでレポートを確認.
$ smartctl -a /dev/disk1s1🆑
smartctl 7.2 2020-12-30 r5155 [Darwin 18.7.0 x86_64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Device Model: TOSHIBA THNSNH512GCST
Serial Number: 33JS103OTD4Y
LU WWN Device Id: 5 00080d b00018cec
Firmware Version: HTSAN104
User Capacity: 512,110,190,592 bytes [512 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
Form Factor: 2.5 inches
TRIM Command: Available, deterministic, zeroed
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ACS-2 (minor revision not indicated)
SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Tue Mar 2 09:50:47 2021 JST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED🈁
General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
was never started.
Auto Offline Data Collection:
Disabled.
Self-test execution status: (
0) The previous self-test routine completed
without error or no self-test has
ever
been run.
Total time to complete Offline
data collection: ( 120) seconds.
Offline data collection
capabilities: (0x5b) SMART execute Offline immediate.
Auto Offline data collection
on/off support.
Suspend Offline collection upon
new
command.
Offline surface scan supported.
Self-test supported.
No Conveyance Self-test supported.
Selective Self-test supported.
SMART
capabilities:
(0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 27) minutes.
SCT capabilities: (0x0039) SCT Status supported.
SCT Error Recovery Control
supported.
SCT Feature Control supported.
SCT Data Table supported.
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME
FLAG VALUE WORST THRESH
TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000a
100 100 000
Old_age Always
- 0
2 Throughput_Performance 0x0005 100
100 050 Pre-fail
Offline
- 0
3
Spin_Up_Time
0x0007 100 100
050 Pre-fail
Always
- 0
5 Reallocated_Sector_Ct 0x0013
100 100 050 Pre-fail
Always
- 0
7 Unknown_SSD_Attribute 0x000b
100 100 050 Pre-fail
Always
- 0
8 Unknown_SSD_Attribute 0x0005
100 100 050 Pre-fail
Offline
- 0
9
Power_On_Hours
0x0012 100 100 000
Old_age Always
- 870
10 Unknown_SSD_Attribute 0x0013
100 100 050 Pre-fail
Always
- 0
12 Power_Cycle_Count
0x0012 100 100 000
Old_age Always
- 29172
167 Unknown_Attribute
0x0022 100 100 000
Old_age Always
- 0
168 Unknown_Attribute
0x0012 100 100 000
Old_age Always
- 0
169 Unknown_Attribute
0x0013 100 100 010
Pre-fail Always
- 100
170 Unknown_Attribute
0x0013 100 100 010
Pre-fail Always
- 0
173 Unknown_Attribute
0x0012 187 187 000
Old_age Always
- 0
175 Program_Fail_Count_Chip 0x0013 100
100 010 Pre-fail
Always
- 0
192 Power-Off_Retract_Count 0x0012 100
100 000 Old_age
Always
- 10
194 Temperature_Celsius 0x0022
067 052 000
Old_age Always
- 33 (Min/Max 17/48)
197 Current_Pending_Sector 0x0012 100
100 000 Old_age
Always
- 0
240 Unknown_SSD_Attribute 0x0013 100
100 050 Pre-fail
Always
- 0
SMART Error Log Version: 1
No Errors Logged🈁
SMART Self-test log structure revision number 1
Num Test_Description
Status
Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed
without error
00%
870 -
SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
[macmini2014:ujpadmin 09:50:47 ~ ]
$
- No Errors Loggedとでているので安全かな.
- ロングバージョン.
自己診断の実行(long)
- 次に,27分かかるロングバージョンのテストを実行する.
$ smartctl -t long /dev/disk1s1
smartctl 7.2 2020-12-30 r5155 [Darwin 18.7.0 x86_64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Extended self-test routine immediately in off-line mode".
Drive command "Execute SMART Extended self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 27 minutes for test to complete.
Test will complete after Tue Mar 2 15:37:53 2021 JST🈁
Use smartctl -X to abort test.
[macmini2014:ujpadmin 15:10:53 ~」]
- ちゃんと27分後の時間を提示してくれている.丁寧だな.
- 時間が経過したので,全部表示する.
[macmini2014:ujpadmin 15:39:05 ~ ]
$ smartctl -a /dev/disk1s1🆑
smartctl 7.2 2020-12-30 r5155 [Darwin 18.7.0 x86_64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Device Model: TOSHIBA THNSNH512GCST
Serial Number: 33JS103OTD4Y
LU WWN Device Id: 5 00080d b00018cec
Firmware Version: HTSAN104
User Capacity: 512,110,190,592 bytes [512 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
Form Factor: 2.5 inches
TRIM Command: Available, deterministic, zeroed
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ACS-2 (minor revision not indicated)
SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Tue Mar 2 15:39:06 2021 JST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
was never started.
Auto Offline Data Collection:
Disabled.
Self-test execution status: (
0) The previous self-test routine completed
without error or no self-test has
ever
been run.
Total time to complete Offline
data collection: ( 120) seconds.
Offline data collection
capabilities: (0x5b) SMART execute Offline immediate.
Auto Offline data collection
on/off support.
Suspend Offline collection upon
new
command.
Offline surface scan supported.
Self-test supported.
No Conveyance Self-test supported.
Selective Self-test supported.
SMART
capabilities:
(0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 27) minutes.
SCT capabilities: (0x0039) SCT Status supported.
SCT Error Recovery Control
supported.
SCT Feature Control supported.
SCT Data Table supported.
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME
FLAG VALUE WORST THRESH
TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000a
100 100 000
Old_age Always
- 0
2 Throughput_Performance 0x0005 100
100 050 Pre-fail
Offline
- 0
3
Spin_Up_Time
0x0007 100 100
050 Pre-fail
Always
- 0
5 Reallocated_Sector_Ct 0x0013
100 100 050 Pre-fail
Always
- 0
7 Unknown_SSD_Attribute 0x000b
100 100 050 Pre-fail
Always
- 0
8 Unknown_SSD_Attribute 0x0005
100 100 050 Pre-fail
Offline
- 0
9
Power_On_Hours
0x0012 100 100 000
Old_age Always
- 876
10 Unknown_SSD_Attribute 0x0013
100 100 050 Pre-fail
Always
- 0
12 Power_Cycle_Count
0x0012 100 100 000
Old_age Always
- 29236
167 Unknown_Attribute
0x0022 100 100 000
Old_age Always
- 0
168 Unknown_Attribute
0x0012 100 100 000
Old_age Always
- 0
169 Unknown_Attribute
0x0013 100 100 010
Pre-fail Always
- 100
170 Unknown_Attribute
0x0013 100 100 010
Pre-fail Always
- 0
173 Unknown_Attribute
0x0012 187 187 000
Old_age Always
- 0
175 Program_Fail_Count_Chip 0x0013 100
100 010 Pre-fail
Always
- 0
192 Power-Off_Retract_Count 0x0012 100
100 000 Old_age
Always
- 10
194 Temperature_Celsius 0x0022
070 052 000
Old_age Always
- 30 (Min/Max 17/48)
197 Current_Pending_Sector 0x0012 100
100 000 Old_age
Always
- 0
240 Unknown_SSD_Attribute 0x0013 100
100 050 Pre-fail
Always
- 0
SMART Error Log Version: 1
No Errors Logged🈁
SMART Self-test log structure revision number 1
Num Test_Description
Status
Remaining LifeTime(hours) LBA_of_first_error
# 1 Extended offline Completed without
error
00%
875 -
# 2 Short offline Completed
without error
00%
875 -
# 3 Extended offline Completed without
error
00%
870 -
# 4 Short offline Completed
without error
00%
870 -
SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
[macmini2014:ujpadmin 15:39:06 ~ ]
$
- ただし,OSの入っているドライブの調査なので,正確な数値は出てない可能性もある...気がする.
参考
- S.M.A.R.T.値の項目説明
- https://hddbancho.co.jp/hdd_smart.html