Raidframe: ソフトウエア RAID 1 の設定例

ここでは、 Raidframe を使って sd0e sd1e の2台のディスクで RAID 1 を行なうことを考えます。

カーネルで有効にする

まずカーネルで raidframe が有効になっているかどうかを確認して下さい。 昔の NetBSD では、無効がデフォルトのはずです。

最近(たとえば 4.0)の GENERIC カーネルはデフォルトで有効です。 起動時に

Kernelized RAIDframe activated
と言っていればカーネルに Raidframe は組み込まれています。

もし、組み込まれていないなら、カーネルを再構築する必要があります。 カーネルの config で次のようにコメントになっている部分

#pseudo-device  raid            4       # RAIDframe disk driver
このコメントを外し、カーネルを作りなおしてください。
pseudo-device  raid            4       # RAIDframe disk driver

/etc/raid0.conf を書く

詳しくは、raidctl(8) のマニュアルを参照。 このような感じです。

START array
1 2 0

START disks
/dev/sd0e
/dev/sd1e

START  layout
128 1 1 1

START queue
fifo 100

この後、raid0.conf を raidframe に教え込み、IDをつけます。

# raidctl -C raid0.conf raid0
# raidctl -I YYYYMMDD raid0
ID は unique なら適当で良いです。 ”-I シリアル番号”です。 適当につけるのも忘れるもとなので、ぼくは日付などをつかっています。

RAID エリアを初期化する。disklabel も忘れずに

# raidctl -iv raid0
初期化後、ディスクラベルを調整し、newfs します。
# disklabel raid0 > /tmp/label
/tmp/label を適宜編集し、書き込みます。
# disklabel -R -r raid0 /tmp/label
raid0a でも raid0e でも何でもいいんですが、 ここでは raid0a にしておきます。 raid0a を作って newfs する。
# newfs /dev/rraid0a

mount してください。

# mount /dev/rraid0a /vol
場合によっては再設定する必要があることもあるようです?
# raidctl -c raid0.conf raid0

現在のステータスを見る

復旧終了後 or 正常時の表示の様子

# raidctl -s raid0
Components:
           /dev/sd0e: optimal
           /dev/sd1e: optimal
No spares.
Component label for /dev/sd0e:
   Row: 0 Column: 0 Num Rows: 1 Num Columns: 2
   Version: 2 Serial Number: 20010220 Mod Counter: 381402380
   Clean: No Status: 0
   sectPerSU: 128 SUsPerPU: 1 SUsPerRU: 1
   RAID Level: 1  blocksize: 512 numBlocks: 3752320
   Autoconfig: No
   Root partition: No
   Last configured as: raid0
Component label for /dev/sd1e:
   Row: 0 Column: 1 Num Rows: 1 Num Columns: 2
   Version: 2 Serial Number: 20010220 Mod Counter: 381402380
   Clean: No Status: 0
   sectPerSU: 128 SUsPerPU: 1 SUsPerRU: 1
   RAID Level: 1  blocksize: 512 numBlocks: 3752320
   Autoconfig: No
   Root partition: No
   Last configured as: raid0
Parity status: DIRTY
Reconstruction is 100% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.

修復

何らかの理由で sd1e が raidframe の制御から外れた場合の 修復を考えます。

# raidctl -s raid0
Components:
           /dev/sd0e: optimal
           /dev/sd1e: failed
No spares.
Component label for /dev/sd0e:
   Row: 0 Column: 0 Num Rows: 1 Num Columns: 2
   Version: 2 Serial Number: 20010511 Mod Counter: 381402546
   Clean: No Status: 0
   sectPerSU: 32 SUsPerPU: 1 SUsPerRU: 1
   RAID Level: 1  blocksize: 512 numBlocks: 2086432
   Autoconfig: No
   Root partition: No
   Last configured as: raid0
/dev/sd1e status is: failed.  Skipping label.
Parity status: DIRTY
Reconstruction is 100% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.
のように表示されている状態です。 もっともハードが完全に壊れた場合は交換しかありません。

reconsturction process は kernel thread として走ります。 raidctl で raidframe ドライバに直せと命令を送ることで 修復が始まります。

ここでは /dev/sd1e が壊れたとします。 次のように raidctl を実行してください。

# raidctl -R /dev/sd1e raid0
status をみると、修復中はこんな感じです。
# raidctl -s raid0
Components:
           /dev/sd0e: optimal
           /dev/sd1e: reconstructing
No spares.
Component label for /dev/sd0e:
   Row: 0 Column: 0 Num Rows: 1 Num Columns: 2
   Version: 2 Serial Number: 20010511 Mod Counter: 381402546
   Clean: No Status: 0
   sectPerSU: 32 SUsPerPU: 1 SUsPerRU: 1
   RAID Level: 1  blocksize: 512 numBlocks: 2086432
   Autoconfig: No
   Root partition: No
   Last configured as: raid0
/dev/sd1e status is: reconstructing.  Skipping label.
Parity status: DIRTY
Reconstruction is 1% complete.
Parity Re-write is 100% complete.
Copyback is 100% complete.
この時のカーネルメッセージはこんな感じです。
SCSIRATE == 0x0
sd1(ahc1:2:0): Queuing a BDR SCB
sd1(ahc1:2:0): Bus Device Reset Message Sent
raid0: node (Wsd) returned fail, rolling forward
raid0: node (Wsd) returned fail, rolling forward
sd1(ahc1:2:0): no longer in timeout, status = 0
raid0: node (Wsd) returned fail, rolling forward
ahc1: Bus Device Reset on A:2. 4 SCBs aborted
ahc1: target 2 synchronous at 10.0MHz, offset = 0xf
raid0: node (Wsd) returned fail, rolling forward
Rebuild: 0 1
Closed the open device: /dev/sd1e
About to (re-)open the device for rebuilding: /dev/sd1e
RECON: initiating in-place reconstruction on
       row 0 col 1 -> spare at row 0 col 1
Quiescence reached..

references

http://www.daemonnews.org/200005/raidframe.html

Greg Ostar による RaidFrame の説明

my homepage is www.fml.org/home/fukachan/.
my free softwares are found at www.fml.org/software/.
fml 4.0 project homepage is www.fml.org/fml/menu.ja.html.
fml 8.0 (fml-devel) project homepage is www.fml.org/software/fml8/.
about one floppy bsd routers, see www.bsdrouter.org/.
Also, visit nuinui's world :) at www.nuinui.net.
For questions about me, e-mail <fukachan@fml.org>.
Copyright (C) 1993-2008 Ken'ichi Fukamachi

Powered by NetBSD.