BTRFS で運用していた HDD に不良セクタが目立ってきたので交換した話
私はbtrfsで自作NASを運用しています。そのHDDに不良セクタが目立つようになってきたので交換した話です。
現在のディスク構成
2台のディスクでミラーリングを行っており、ディスクは以下の2台です。
- 1台目: 東芝 DT01ACA300 ※普通のデスクトップ用HDD
- 2台目: Western Digital Blue 3TB (WDC WD30EZRZ-00Z5HB0)
この2台目(WD Blue)の健康状態が怪しいので、別の同型番のHDDに交換します。 そもそも Blue は NAS に向けたハードディスクではありませんが、それを承知の上で使用しています。メーカーの違うHDDとミラーリングしているし、同時故障する可能性はほとんどないだろうと思った上での導入です。Blue の 3TB は当時はお手頃だった(1万円くらい)ので倉庫用としてたくさん購入しており、より大容量のものと買い替えて余ったので、NAS に転用しました。
交換前のディスクの使用状況はこんな感じ。3TBのHDDを2台でミラーリングしています。
$ sudo btrfs fi usage /storage/nas Overall: Device size: 5.46TiB Device allocated: 2.83TiB Device unallocated: 2.62TiB Device missing: 0.00B Used: 2.83TiB Free (estimated): 1.31TiB (min: 1.31TiB) Data ratio: 2.00 Metadata ratio: 1.67 Global reserve: 512.00MiB (used: 0.00B) : :
交換するディスクの S.M.A.R.T. 情報は以下。
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 176 172 021 Pre-fail Always - 6158 4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 365 5 Reallocated_Sector_Ct 0x0033 200 200 140 Pre-fail Always - 14 7 Seek_Error_Rate 0x002e 200 200 000 Old_age Always - 0 9 Power_On_Hours 0x0032 084 084 000 Old_age Always - 11953 10 Spin_Retry_Count 0x0032 100 100 000 Old_age Always - 0 11 Calibration_Retry_Count 0x0032 100 100 000 Old_age Always - 0 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 169 192 Power-Off_Retract_Count 0x0032 200 200 000 Old_age Always - 95 193 Load_Cycle_Count 0x0032 199 199 000 Old_age Always - 3789 194 Temperature_Celsius 0x0022 126 098 000 Old_age Always - 24 196 Reallocated_Event_Count 0x0032 189 189 000 Old_age Always - 11 197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 93 198 Offline_Uncorrectable 0x0030 200 200 000 Old_age Offline - 88 199 UDMA_CRC_Error_Count 0x0032 200 200 000 Old_age Always - 0 200 Multi_Zone_Error_Rate 0x0008 200 200 000 Old_age Offline - 344
- Reallocated_Sector_Ct: 14
- Current_Pending_Sector: 93
- Offline_Uncorrectable: 88
まあまあ目立ってると思います。稼働時間は11953Hr(1.4年)。感覚的にはNAS用として3年ほど使用したと思います。hdparm -S を使用して無アクセスのときスピンダウンするような運用も行っていましたので、その時間がカウント外になっているのかもしれません。 S.M.A.R.T のログによると、3週間前は以下の数値でした。なんか爆増にように見えます。
- Current_Pending_Sector: 86
- Offline_Uncorrectable: 81
ただ、btrfsで特段の不都合やエラーがあったわけではなさそうです。
$ sudo btrfs device stat /storage/nas [/dev/sdd].write_io_errs 0 [/dev/sdd].read_io_errs 0 [/dev/sdd].flush_io_errs 0 [/dev/sdd].corruption_errs 0 [/dev/sdd].generation_errs 0 [/dev/sda].write_io_errs 0 [/dev/sda].read_io_errs 0 [/dev/sda].flush_io_errs 0 [/dev/sda].corruption_errs 0 [/dev/sda].generation_errs 0
しばらく続投できると思うのですが、不良セクタの気味が悪いのでディスクを交換します。
なお、ペアとなっている東芝(/dev/sdd)の S.M.A.R.T. は以下です。
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 1 Raw_Read_Error_Rate 0x000b 100 100 016 Pre-fail Always - 0 2 Throughput_Performance 0x0005 140 140 054 Pre-fail Offline - 67 3 Spin_Up_Time 0x0007 144 144 024 Pre-fail Always - 387 (Average 411) 4 Start_Stop_Count 0x0012 100 100 000 Old_age Always - 433 5 Reallocated_Sector_Ct 0x0033 100 100 005 Pre-fail Always - 0 7 Seek_Error_Rate 0x000b 100 100 067 Pre-fail Always - 0 8 Seek_Time_Performance 0x0005 119 119 020 Pre-fail Offline - 35 9 Power_On_Hours 0x0012 095 095 000 Old_age Always - 37105 10 Spin_Retry_Count 0x0013 100 100 060 Pre-fail Always - 0 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 187 192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 902 193 Load_Cycle_Count 0x0012 100 100 000 Old_age Always - 902 194 Temperature_Celsius 0x0002 230 230 000 Old_age Always - 26 (Min/Max 9/47) 196 Reallocated_Event_Count 0x0032 100 100 000 Old_age Always - 0 197 Current_Pending_Sector 0x0022 100 100 000 Old_age Always - 0 198 Offline_Uncorrectable 0x0008 100 100 000 Old_age Offline - 0 199 UDMA_CRC_Error_Count 0x000a 200 200 000 Old_age Always - 0
- Reallocated_Sector_Ct: 0
- Current_Pending_Sector: 0
- Offline_Uncorrectable: 0
このディスクは2017年3月に購入したものでした。稼働時間は37105Hr(4.2年)。 素晴らしいですね。私の中での東芝HDDの信頼性が爆上がりです。
でもまあ、このディスクのプレスリリースによると、Western Digital から買収した製造設備を活用して作った製品のようですから、東芝ではなく Western Digital の実力なのかもしれません。
交換作業
今回は交換元/交換先の両方が使用可能な状態なので、btrfs replace
コマンドを使用します。
もし交換元が死んでいたりする場合は、btrfs add/remove
を使用するようです。
コマンドの構文を確認。
$ btrfs replace usage: btrfs replace <command> [<args>] btrfs replace start [-Bfr] <srcdev>|<devid> <targetdev> <mount_point> Replace device of a btrfs filesystem. btrfs replace status [-1] <mount_point> Print status and progress information of a running device replace btrfs replace cancel <mount_point> Cancel a running device replace operation. replace a device in the filesystem
/dev/sda を、 /dev/sdc に交換。
$ sudo btrfs replace start /dev/sda /dev/sdc /storage/nas /dev/sdc appears to contain a partition table (gpt). ERROR: use the -f option to force overwrite of /dev/sdc
交換先のディスクは元倉庫ですのでGPTテーブルがありNTFSパーティションがあります。 このディスク全体をパーティションレスbtrfsで使用するので、指示された通り -f オプションをつけて再実行します。
$ sudo btrfs replace start /dev/sda /dev/sdc /storage/nas -f $ sudo btrfs replace status /storage/nas 0.1% done, 0 write errs, 0 uncorr. read errs
始まったようです。 朝まで放置したところ、3時間半で終わっておりました。
$ sudo btrfs replace status /storage/nas Started on 6.Dec 21:04:39, finished on 7.Dec 00:44:39, 0 write errs, 0 uncorr. read errs
ちなみに、交換先のディスクの S.M.A.R.T. 情報は以下の通り。
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 176 021 Pre-fail Always - 5841 4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 212 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 099 099 000 Old_age Always - 858 10 Spin_Retry_Count 0x0032 100 100 000 Old_age Always - 0 11 Calibration_Retry_Count 0x0032 100 100 000 Old_age Always - 0 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 171 192 Power-Off_Retract_Count 0x0032 200 200 000 Old_age Always - 125 193 Load_Cycle_Count 0x0032 185 185 000 Old_age Always - 46662 194 Temperature_Celsius 0x0022 129 100 000 Old_age Always - 21 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 200 200 000 Old_age Offline - 0 199 UDMA_CRC_Error_Count 0x0032 200 200 000 Old_age Always - 0 200 Multi_Zone_Error_Rate 0x0008 200 200 000 Old_age Offline - 0
使用時間たったの858時間。そのわりには、Load_Cycle_Count の値がやたら高いです。例の IntelliPark によるものでしょう。 このままNAS用として使用するのは気持ち悪いので、IntelliPark のタイマーを、8秒から300秒に変更します。 300秒の根拠は分かりませんが、どこかで Linux では300秒を推奨とのことを見たことがあるので、それに従うことにします。
$ sudo idle3ctl -s 138 /dev/sdc
なぜ -s 138 で300秒なのかはよくわかりませんが (0x138 = 312)、ググったところ 138 で良いらしいので、そのようにします。
ディスク交換としての作業は終了。長持ちしてくれるといいなあ。