
Home > Debian > トラブルシューティング > RAID1の修復作業
当サーバは、RAID1構成で運営している。このRAID1でエラーが起こった時の復旧策をここではまとめてみる。
状況としては、停電に伴いサーバが異常終了された。その後、起動は問題無くしたが、RAIDでエラーが起こっていた・・・
以下のようなメールが届いていた。
----------------------------------------------------------------------- This is an automatically generated mail message from mdadm running on fiore A DegradedArray event had been detected on md device /dev/md2. Faithfully yours, etc. ----------------------------------------------------------------------- This is an automatically generated mail message from mdadm running on fiore A DegradedArray event had been detected on md device /dev/md1. Faithfully yours, etc. |
/dev/md1と/dev/md2が怪しいので、mdstatを覗いてみると以下のようになっていた。
# cat /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md0 : active raid1 ide/host0/bus0/target0/lun0/part1[0] ide/host0/bus0/target1/lun0/part1[1]
104320 blocks [2/2] [UU]
md1 : active raid1 ide/host0/bus0/target1/lun0/part2[1]
67995008 blocks [2/1] [_U]
md3 : active raid1 ide/host0/bus0/target0/lun0/part5[0] ide/host0/bus0/target1/lun0/part5[1]
521984 blocks [2/2] [UU]
md2 : active raid1 ide/host0/bus0/target1/lun0/part3[1]
9213184 blocks [2/1] [_U]
|
/dev/md1と/dev/md2が同期されていない状態になっている。
/dev/hdaが何か変なことになってるので、fdiskで状況を確認してみる。
# fdisk -l /dev/hda Disk /dev/hda: 81.9 GB, 81964302336 bytes 255 heads, 63 sectors/track, 9964 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 * 1 13 104391 fd Linux raid autodetect /dev/hda2 14 8478 67995112+ fd Linux raid autodetect /dev/hda3 8479 9625 9213277+ fd Linux raid autodetect /dev/hda4 9626 9690 522112+ 5 Extended /dev/hda5 9626 9690 522081 82 Linux swap / Solaris |
e2fsckコマンドで、/dev/hda2と/dev/hda3の修復を試みる。
# e2fsck -p /dev/hda2 # e2fsck -p /dev/hda3 |
ただし、hda2のほうは、-pを抜いて再チェックしろと怒ってくるので、指示に従いました。
ちなみにここでは、-yのオプションを指定しておかないと、yを何回押す羽目になるか分かりません。
# e2fsck -y /dev/hda2 |
/dev/hda2をmd1に、/dev/hda3をmd2に、以下のコマンドで組み込みなおす。
# mdadm /dev/md1 -a /dev/hda2 # mdadm /dev/md2 -a /dev/hda3 |
上記コマンド実行後、すぐには完了しない。ちゃんと修復しているか途中経過の確認をしてみる。
# cat /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md0 : active raid1 ide/host0/bus0/target0/lun0/part1[0] ide/host0/bus0/target1/lun0/part1[1]
104320 blocks [2/2] [UU]
md1 : active raid1 ide/host0/bus0/target0/lun0/part2[2] ide/host0/bus0/target1/lun0/part2[1]
67995008 blocks [2/1] [_U]
[===================>.] recovery = 97.1% (66052756/67995008) finish=0.8min speed=37192K/sec
md3 : active raid1 ide/host0/bus0/target0/lun0/part5[0] ide/host0/bus0/target1/lun0/part5[1]
521984 blocks [2/2] [UU]
md2 : active raid1 ide/host0/bus0/target0/lun0/part3[2] ide/host0/bus0/target1/lun0/part3[1]
9213184 blocks [2/1] [_U]
この状態だとmd1が修復中の状態
|
暫くした後に再び確認してみる。
# cat /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md0 : active raid1 ide/host0/bus0/target0/lun0/part1[0] ide/host0/bus0/target1/lun0/part1[1]
104320 blocks [2/2] [UU]
md1 : active raid1 ide/host0/bus0/target0/lun0/part2[0] ide/host0/bus0/target1/lun0/part2[1]
67995008 blocks [2/2] [UU]
md3 : active raid1 ide/host0/bus0/target0/lun0/part5[0] ide/host0/bus0/target1/lun0/part5[1]
521984 blocks [2/2] [UU]
md2 : active raid1 ide/host0/bus0/target0/lun0/part3[0] ide/host0/bus0/target1/lun0/part3[1]
9213184 blocks [2/2] [UU]
|
上記のようになっていれば、問題無くRAID1が動作しているので、修復完了となる。
最終更新 : 05/22/2006