Vood softare raid installing (简体中文)
Arch Linux Voodoo 软磁盘阵列安装
最近开始尝试voodoo,忽然发现软磁盘阵列安装容易了不少。现将安装过程记录下来,以备参考。
Wiki中,有篇很好的howto Installing with software RAID or LVM ,它也是我这篇文章的起点,建议大家看看。
Lately I begin to try Voodoo and find that the software RAID installation is more easy than ever, so record the installing processes for memo. This memo is based the good howto Installing with software RAID or LVM.
全部安装包括三步:
- 用安装CD启动,分区磁盘,创建磁盘阵列数组
- 进入正常安装程序,到安装内核完成后,退出安装程序
- 手动安装GRUB,重启完成安装
The whole installation includes three steps:
- Boot with installation CD,patition the hard disks and create RAID array.
- Open Arch Linux installing program and begin install process until the kernel has been installed.
- Install Grub manually,reboot to complete installation.
我有两个磁盘:/dev/hda 和 /dev/hdb 各分三个分区 ,其中 hda1,hdb1构建 md0(raid0)为交换分区; hda2 hdb2构建 md1(raid1)为/boot分区; hda3 hdb3构建 md2(raid0),为根分区。需要注意的是,如果你想把根分区建立在raid0上,必须单独建立一个/boot分区,且/boot分区不能设立为raid0,否则,grub安装不会成功。我尝试过几次 ,似乎grub不能识别跨越几个磁盘的区块上的文件,如stage1等,至今没有找到解决的办法。
I have two disks: /dev/hda and /dev/hda,prepare to partition three partitions on each disk, md0 consist of hda1 and hda2 used as swap space (raid0),md1 consist of hda2 and hdb2 used as /boot partiton (raid1),md2 consist of hda3 and hdb3 used as root partition (raid0).Don't put your root partition on a raid0 array unless you will create a alone /boot partition and it's not on a raid0 array,or the grub installation will be not success. I have tried many times,but It seems that Grub don't recognize the file on strips span over mutidisks,such as important stage* files.
具体安装步骤如下:
一、从安装盘启动到提示符下,进行分区及创建磁盘阵列数组
1 cfdisk /dev/hda 2 cfdisk /dev/hdb
各分三个区,分区类型为FD即linux raid autodetect
3 modprobe raid0 4 modprobe raid1
装载系统模块支持
5 mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/hda1 /dev/hdb1 6 mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/hda2 /dev/hdb2 7 mdadm --create /dev/md2 --level=0 --raid-devices=2 /dev/hda3 /dev/hdb3
创建md0,md1,md2三个设备
8 cat /proc/mdstat
查看raid设备状态,看工作是否正常
二、进行正常系统安装
输入/arch/setup 进入正常安装程序,选择磁盘分区中的设定文件系统装载点,你会发现安装程序会 检 测 到三个md设备,你可以按正常磁盘一样安装 到系统内核安装完毕,不安装grub,退出安装程序。 这里不进行手动安装的一个好处是grub安装程序会自动创建正确的fstab文件。
需要注意两点: 一是安装程序询问是否支持software raid启动时,选择是,以便安装程序创建支持software raid的initrd启动文件。 二是在系统mkinitcpio.conf 文件,中加入md配置内容:
md=0, /dev/hda1,/dev/hdb1 md=1, /dev/hda2,/dev/hdb2 md=2 ,/dev/hda3,/dev/hdb3
三、安装grub
退出安装程序回到提示符下,这时md设备已挂载在相应的目录下,如 /dev/md2挂在/mnt下,不需要再手动挂载。 1 mdadm -D --scan >> /etc/mdadm.conf 2 cp /etc/mdadm.conf /mnt/etc/mdadm.conf
在新系统下保存配置信息
3 mount --bind /dev /mnt/dev 4 mount -t proc proc /mnt/proc 5 mount -t sysfs sysfs /mnt/sys 6 chroot /mnt
chroot进入新系统,准备安装grub
7 cp /usr/share/grub/i386/* /boot/grub 8 grub 进入grub shell 提示符下
grub>find /grub/stage1 (hd0,1) (hd1,1) #boot分区是raid1,所以看到两个磁盘上都有stage1文件 grub> root (hd0,1) grub> setup (hd0) grub> root (hd1,1) #在两个硬盘上都安装 grub>setup (hd1) grub>quit
9 调整grub配置
nano /boot/grub/menu.lst
改动 root (hdx,y) 这一行为: root (hd0,1) 或者 (hd1,1) 和上面一致 改动 kernel=/xxx root=yyy 这一行为 kernel=/xxx, root=/dev/md2 md=2,/dev/hda3,/dev/hdb3 ro
10 保存修改,键入ctrl+d退出chroot环境,卸载已挂载的分区,重启,进入新系统,一切应该OK。
voodoo下测试成功。怎么样?是不是很简单?