📓 memotty

Raspberry Pi 4で構築したプライベートネットワークNASの状態をチェックする

前提 #

  • SSH接続できるようにしておく
    # ipアドレスは適当、割り当てられてるipを書いてください
    ssh pi@192.168.1.10

ディスク容量を確認 #

motty@raspi-nas:~ $ df -h
ファイルシス   サイズ  使用  残り 使用% マウント位置
/dev/root        118G  3.7G  109G    4% /
devtmpfs         1.8G     0  1.8G    0% /dev
tmpfs            1.9G     0  1.9G    0% /dev/shm
tmpfs            1.9G   15M  1.9G    1% /run
tmpfs            5.0M  4.0K  5.0M    1% /run/lock
tmpfs            1.9G     0  1.9G    0% /sys/fs/cgroup
/dev/md0         2.7T  1.8T  815G   69% /home/samba
/dev/mmcblk0p1   253M   48M  205M   19% /boot
tmpfs            388M     0  388M    0% /run/user/1000

まあまあ使ってますね。

ディスクの健康状態を確認する(重要) #

ソフトをインストール #

sudo apt update

sudo apt install smartmontools

RAID構成の確認 #

次にこのNASはRAIDを組んでいるので、それをまずチェック。

motty@raspi-nas:~ $ cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb1[1] sda1[0]
      2930133440 blocks super 1.2 [2/2] [UU]
      bitmap: 0/22 pages [0KB], 65536KB chunk

unused devices: <none>

物理ディスクの確認 #

実際のディスク一覧を確認する。

motty@raspi-nas:~ $ lsblk -o NAME,SIZE,MODEL
NAME          SIZE MODEL
sda           2.7T WDC_WD30EFRX-68EUZN0
└─sda1        2.7T
  └─md0       2.7T
sdb           2.7T WDC_WD30EFRX-68EUZN0
└─sdb1        2.7T
  └─md0       2.7T
mmcblk0     119.3G
├─mmcblk0p1   256M
└─mmcblk0p2   119G

各ディスクのSMART情報を確認 #

最初に入れたソフトを/dev/sda//dev/sdbに対して個別実行

まずはsdaの結果。

motty@raspi-nas:~ $ sudo smartctl -a -d sat /dev/sda
smartctl 6.6 2017-11-05 r4594 [armv7l-linux-5.10.11-v7l+] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

= START OF INFORMATION SECTION =
Model Family:     Western Digital Red
Device Model:     WDC WD30EFRX-68EUZN0
Serial Number:    WD-WCC4N1XYEYVN
LU WWN Device Id: 5 0014ee 2bd306557
Firmware Version: 82.00A82
User Capacity:    3,000,592,982,016 bytes [3.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Mon Oct 27 15:21:32 2025 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:                (40560) seconds.
Offline data collection
capabilities:                    (0x7b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        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:        ( 407) minutes.
Conveyance self-test routine
recommended polling time:        (   5) minutes.
SCT capabilities:              (0x703d) 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     0x002f   200   200   051    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0027   183   181   021    Pre-fail  Always       -       5808
  4 Start_Stop_Count        0x0032   099   099   000    Old_age   Always       -       1169
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002e   200   200   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   043   043   000    Old_age   Always       -       42104
 10 Spin_Retry_Count        0x0032   100   100   000    Old_age   Always       -       0
 11 Calibration_Retry_Count 0x0032   100   253   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       13
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       0
193 Load_Cycle_Count        0x0032   200   200   000    Old_age   Always       -       2873
194 Temperature_Celsius     0x0022   108   096   000    Old_age   Always       -       42
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   100   253   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0008   100   253   000    Old_age   Offline      -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

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.

次にsdbの結果。

motty@raspi-nas:~ $ sudo smartctl -a -d sat /dev/sdb
smartctl 6.6 2017-11-05 r4594 [armv7l-linux-5.10.11-v7l+] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

= START OF INFORMATION SECTION =
Model Family:     Western Digital Red
Device Model:     WDC WD30EFRX-68EUZN0
Serial Number:    WD-WCC4N1XYEU7D
LU WWN Device Id: 5 0014ee 267dab64e
Firmware Version: 82.00A82
User Capacity:    3,000,592,982,016 bytes [3.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Mon Oct 27 15:23:20 2025 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:                (40320) seconds.
Offline data collection
capabilities:                    (0x7b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        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:        ( 404) minutes.
Conveyance self-test routine
recommended polling time:        (   5) minutes.
SCT capabilities:              (0x703d) 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     0x002f   200   200   051    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0027   186   182   021    Pre-fail  Always       -       5700
  4 Start_Stop_Count        0x0032   099   099   000    Old_age   Always       -       1156
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002e   200   200   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   043   043   000    Old_age   Always       -       42195
 10 Spin_Retry_Count        0x0032   100   100   000    Old_age   Always       -       0
 11 Calibration_Retry_Count 0x0032   100   253   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       12
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       0
193 Load_Cycle_Count        0x0032   200   200   000    Old_age   Always       -       2815
194 Temperature_Celsius     0x0022   109   096   000    Old_age   Always       -       41
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   100   253   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0008   100   253   000    Old_age   Offline      -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

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.

結果発表 #

sda #

項目内容評価
モデル名WD Red 3TB (WDC WD30EFRX)NAS用HDDで信頼性高いモデル
SMART self-assessmentPASSED✅ 問題なし
使用時間 (Power_On_Hours)42104時間 ≒ 約 4.8年連続稼働⚠ 長期稼働だが、NAS用途なら想定内
代替セクタ数 (Reallocated_Sector_Ct)0✅ 完全正常
代替イベント数 (Reallocated_Event_Count)0✅ 正常
現在保留セクタ (Current_Pending_Sector)0✅ 正常
オフライン訂正不能セクタ (Offline_Uncorrectable)0✅ 正常
CRCエラー (UDMA_CRC_Error_Count)0✅ ケーブル接触不良などもなし
温度 (Temperature_Celsius)42℃⚠ やや高め(許容範囲内、NASで常時稼働なら問題なし)
スピンアップ回数 (Start_Stop_Count)1169少なめ、良好
ロードサイクル数 (Load_Cycle_Count)2873良好

sdb #

項目内容評価
SMART全体評価PASSED✅ 問題なし
使用時間 (Power_On_Hours)42195時間 ≒ 約4.8年稼働⚠ 長期稼働(許容範囲内)
再配置セクタ数 (Reallocated_Sector_Ct)0✅ 不良セクタなし
保留セクタ (Current_Pending_Sector)0✅ 問題なし
訂正不能セクタ (Offline_Uncorrectable)0✅ 問題なし
CRCエラー (UDMA_CRC_Error_Count)0✅ ケーブル異常なし
温度 (Temperature_Celsius)41℃⚠ やや高め(許容範囲内)
スピンアップ回数 / ロードサイクル1156 / 2815✅ 正常範囲
Start_Stop_Count1156✅ 正常

sdaとsdbの比較 #

項目sdasdbコメント
モデルWD30EFRXWD30EFRX同一モデル
稼働時間42104h42195hほぼ一致(同時運用)
温度42℃41℃問題なし
再配置セクタ00完全一致
CRCエラー00接続良好
SMART結果PASSEDPASSED両方とも良好

RAIDミラー構成としては理想的っぽい。

今後やること #

  • 定期チェック
    • 家族discord鯖に毎月smartctlの結果を投げるのがよさそう
  • 自動テストの設定
    • これも定期チェックに組み込む
  • 温度監視
    • ちょっと高め、ウォークインクローゼットの上に置いているので排熱気を付ける
    • 夏場は冷房が入らないので締め切らない、冬場は問題なさそう
  • RAID状態の確認
    • sudo mdadm --detail /dev/md0 の結果をdiscordに投げる、State: cleanであれば安心

終わりに #

Raspberry Pi NASの運用がもうそろそろ5年になります。
停電したり引っ越しの時に業者に勝手にコンセント抜かれたりと、トラブルはありつつも問題なく動いています。
長期運用で困ったことは光回線が変わってIPが変更された時くらいです。
とても安く運用できるので、ぜひ皆さんもこれを機にRaspberry PiでRAID構成 samba NASを構築しましょう。