modprobe raid1
fdisk /dev/sda
fdisk /dev/sdb
Device Boot Start End Blocks Id System
/dev/hda1 1 32 257008+ 83 Linux
/dev/hda2 33 64 257040 82 Linux swap
/dev/hda3 65 15017 120109972+ 83 Linux
Device Boot Start End Blocks Id System
/dev/hdb1 1 32 257008+ 83 Linux
/dev/hdb2 33 64 257040 82 Linux swap
/dev/hdb3 65 14593 116704192+ 83 Linux
cd /dev
MAKEDEV md
3.建立 RAID 設定 /etc/raidtab
我的是如下,都是 RAID1: (更多說明請看:http://forums.gentoo.org/viewtopic.php?t=8813&highlight=raid)
# /boot
raiddev /dev/md0
raid-level 1
nr-raid-disks 2
chunk-size 32
persistent-superblock 1
device /dev/sda1
raid-disk 0
device /dev/sdb1
raid-disk 1
# /
raiddev /dev/md1
raid-level 1
nr-raid-disks 2
chunk-size 32
persistent-superblock 1
device /dev/sda3
raid-disk 0
device /dev/sdb3
raid-disk 1
4.
mkraid –really-force /dev/md0
mkraid –really-force /dev/md1
5.
mkreiserfs /dev/md0
mkreiserfs /dev/md1
6.
mount /dev/md1 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/md0 /mnt/gentoo/boot
7.開始灌你的 gentoo,這部份跟一般灌法一樣,別忘了RAID 的功能要 compile 進 kernel,下面是我的設定.
[*] Multiple devices driver support (RAID and LVM)
x x <*> RAID support
x x <*> Linear (append) mode
x x <*> RAID-0 (striping) mode
x x <*> RAID-1 (mirroring) mode
x x <M> RAID-4/RAID-5 mode
x x <*> Multipath I/O support
x x <M> Logical volume manager (LVM) support
x x < > Device-mapper support
8.灌好了嗎?來設一下我們的 /etc/fstab 及 /boot/grub/grub.conf 這部份很重要,我挖了兩天的資料才設好呢!
/etc/fstab:
/dev/md/0 /boot reiserfs notail,noauto,noatime 1 1
/dev/md1 / reiserfs noatime 0 0
/dev/hda2 none swap sw 0 0
/dev/hdb2 none swap sw 0 0
/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/boot/grub/grub.conf:
#
# Sample boot menu configuration file
#
# Boot automatically after 30 secs.
timeout 10
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
# By default, boot the first entry.
default 0
# Fallback to the second entry.
fallback 1
# For booting GNU/Hurd
title Linux/linux-2.4.25-gentoo-r2
root (hd0,0)
kernel (hd0,0)/boot/kernel-2.4.25-gentoo-r2 root=/dev/md1 md=1,/dev/hda3,/dev/hdb3 vga=788
#grub
grub > root (hd0,x)
grub > setup (hd0)
9.都設好以後,install 你的 boot loader (grub),這部份也是跟一般 install 一樣,只要注意你的 /etc/fstab 及 /boot/grub/grub.conf也別忘了要把你的 /etc/raidtab cp 到你的 /tmp/gentoo/etc 下面哦!
10.reboot
11.如果你是 RAID1,你可以把其中一個拔下,模擬一個HD掛掉,系統可以順利開機順利使用,
把另一個HD資料砍掉,fdisk 成原本的割法.
再下
raidhotadd /dev/md0 /dev/hda1
raidhotadd /dev/md1 /dev/hda3
你可看 /proc/mdstat raid 的 status,如果剛加入新的HD,會有出現資料同步的 status.