*Soft Raid [#d02f8913]

RIGHT:更新日 &lastmod();

**DISK構成 [#maa3b95b]

raidの構成

 hda
                <================= RAID ================>
 --------------------------------------------------------
 |/boot(500MB) |/ (18GB)                    |swap (1GB) |
 --------------------------------------------------------
     hda1           md0(hda2)                 md1(hda3)

 hdb
                <================= RAID ================>
 --------------------------------------------------------
 |/boot2(500MB)|/ (18GB)                    |swap (1GB) |
 --------------------------------------------------------
     hdb1           md0(hdb2)                 md1(hdb3)

Linuxインストール時に上記のようにパーテションを作成する。/bootはraid化できない
ので、hdbには同じ大きさの/boot2をダミーで作成しておく。その後、以下のようにfstabでコメントアウトしてマウントされないようにする


/etc/fstab
以下のようにコメントアウト

 # LABEL=/boot2            /boot2                  ext3    defaults        1 2


**bootパーティションのコピー [#x7a8e16e]

再起動後/bootの内容をhdb1にコピーする

dd if=/dev/hda1 of=/dev/hdb1 bs=512 (*hd[ab]1=bootパーティション)

 # dd if=/dev/hda1 of=/dev/hdb1 bs=512
 1028097+0 records in
 1028097+0 records out
 526385664 bytes (526 MB) copied, 9.2453 seconds, 56.9 MB/s

''mountして確認''

 # mount /dev/hdb1 /mnt
 # ls /mnt
 System.map@                grub/                      lost+found/
 System.map-2.6.16-0vl68    initrd-2.6.16-0vl68.img    vmlinuz@
 System.map-2.6.16-0vl76.3  initrd-2.6.16-0vl76.3.img  vmlinuz-2.6.16-0vl68
 System.map.old@            initrd.img@                vmlinuz-2.6.16-0vl76.3
 config-2.6.16-0vl68        initrd.old.img@            vmlinuz.old@
 config-2.6.16-0vl76.3      kernel.h

&color(red){kernelのUpdateしたときはコピーしておく必要がある};


***MBRのコピー [#l11c1473]

hdaが破壊されるとhdbにはMBRが書き込まれていないので起動できない。そこで先にhdaのMBRをhdbにコピーしておきhdaが破壊されたときはhdbにあるHDDをマスターにして起動できるようにしておく。

''MBRというファイルにhdaのMBRをコピー''~
dd if=/dev/hda of=./MBR bs=512 count=1~

''ファイルMBRをhdbのMBRにコピー''~
dd if=./MBR of=/dev/hdb bs=446 count=1  &color(red){<==bsが512でなく446であることに注意};

 # dd if=/dev/hda of=./MBR bs=512 count=1
 1+0 records in
 1+0 records out
 512 bytes (512 B) copied, 0.005724 seconds, 89.4 kB/s
 
 # dd if=./MBR of=/dev/hdb bs=446 count=1
 1+0 records in
 1+0 records out
 446 bytes (446 B) copied, 0.000928 seconds, 481 kB/s

**ドライブの交換 [#ne4a7206]
破壊されたディスクの交換を行う~
新しいHDDを接続し、残ったHDDと同じようにfdiskでパーテションを作成する~
容量が多くなればよさそう

''元DISK(20GB)''

 Disk /dev/hda: 21.4 GB, 21474836480 bytes
 255 heads, 63 sectors/track, 2610 cylinders
 Units = シリンダ数 of 16065 * 512 = 8225280 bytes
 
  デバイス Boot      Start         End      Blocks   Id  System
 /dev/hda1   *           1          64      514048+  83  Linux
 /dev/hda2              65        2473    19350292+  fd  Linux raid 自動検出
 /dev/hda3            2474        2610     1100452+  fd  Linux raid 自動検出


''新追加DISK(24GB)''

 Disk /dev/hdb: 25.7 GB, 25769803776 bytes
 15 heads, 63 sectors/track, 53261 cylinders
 Units = シリンダ数 of 945 * 512 = 483840 bytes
 
  デバイス Boot      Start         End      Blocks   Id  System
 /dev/hdb1               1        1138      537673+  83  Linux
 /dev/hdb2            1139       44542    20508390   83  Linux
 /dev/hdb3           44543       53261     4119727+  83  Linux

 コマンド (m でヘルプ): t 
 領域番号 (1-4): 2
 16進数コード (L コマンドでコードリスト表示): fd 
 領域のシステムタイプを 2 から fd (Linux raid 自動検出) に変更しました
 
 コマンド (m でヘルプ): p
 
 Disk /dev/hdb: 25.7 GB, 25769803776 bytes
 15 heads, 63 sectors/track, 53261 cylinders
 Units = シリンダ数 of 945 * 512 = 483840 bytes

  デバイス Boot      Start         End      Blocks   Id  System
 /dev/hdb1               1        1138      537673+  83  Linux
 /dev/hdb2            1139       44542    20508390   fd  Linux raid 自動検出
 /dev/hdb3           44543       53261     4119727+  fd  Linux raid 自動検出


***Raidのメンバーに追加 [#vf1d362f]

Vine4.x (Kernel2.6)から再構築のためRaidメンバーに参加させるにはmdadmを使用する
raidhotaddコマンドから、mdadmになった。

hdb2,hdb3をメンバーに参加させる。その後hdb1にddコマンドで/bootをhda1からコピー。

 # /sbin/mdadm /dev/md0 -a /dev/hdb2
 mdadm: re-added /dev/hdb2
 # cat /proc/mdstat
 Personalities : [raid1]
 md1 : active raid1 hdb3[1] hda3[0]
       1100352 blocks [2/2] [UU]
 
 md0 : active raid1 hdb2[2] hda2[0]
       19350208 blocks [2/1] [U_]
       [>....................]  recovery =  0.4% (78208/19350208) finish=24.6min  speed=13034K/sec
 
 unused devices: <none>

もし壊れたHDDがマスタ側のときはMBRを忘れずコピーしておく~
/bootのコピーは必ず必要


**参考 [#pa546c70]

[[Raidの作成:http://wwwism.dyndns.org/hp/linux/raid.htm]]


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS