2009年5月26日火曜日

久しぶりにディスクをミラー化

メインのマシンのハードディスクが壊れた。

ちょうどいい機会なので、43a3-gwでテストしてみる

http://www.s-me.co.jp/ipnuts/ipnuts41/server/ch02s02.html
 を 参照

ディスクまるごとミラーする。
fdisk で /dev/hdaと/dev/hdcの新規HDを確認

IPnuts.mydomain# fdisk -l

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/hda doesn't contain a valid partition table

Disk /dev/hdc: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/hdc doesn't contain a valid partition table

Disk /dev/sda: 128 MB, 128974848 bytes
16 heads, 32 sectors/track, 492 cylinders
Units = cylinders of 512 * 512 = 262144 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sda1 * 1 492 125936 6 FAT16


作業でこのメモを書くためscreenをいれる
#lrp_load -b screen

screen起動
#screen

sshで作業するのでパスワードを設定
#passwd

ここからがmdの作業

mdadmをいれる
# lrp_load -b mdadm


RAIDの作成 注意:/dev/md0ではなく/dev/md/0にすること
# mdadm --create --auto=yes /dev/md/0 --level=1 --raid-devices=2 /dev/hda /dev/hdc
# mdadm -E --scan >> /etc/mdadm/mdadm.conf

/etc/mdadm/mdadm.confにDEVICEの行を追加し、
--scan で 追加された ARRAY=の行のUUIDを使って編集する

DEVICE= hda hdc
ARRAY= /dev/md/0 auto=yes UUID=39e476bc:5be27d92:c8fac465:06756b0d

mdadm-raidを実行してからraidの状況を確認

# /etc/init.d/mdadm-raid start
# mdadm --detail /dev/md0

Version : 00.90
Creation Time : Wed May 27 03:52:35 2009
Raid Level : raid1
Array Size : 78150656 (74.53 GiB 80.03 GB)
Used Dev Size : 78150656 (74.53 GiB 80.03 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent

Update Time : Tue May 26 19:37:03 2009
State : active, resyncing
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0

Rebuild Status : 8% complete

UUID : 39e476bc:5be27d92:c8fac465:06756b0d
Events : 0.5

Number Major Minor RaidDevice State
0 3 0 0 active sync /dev/hda
1 22 0 1 active sync /dev/hdc

mdadmを起動時のパッケージに追加して、設定保存

# lrp_list -a mdadm
# save_conf

0 件のコメント: