此描述适用于我的系统规格中描述的 RAID 系统。您的系统可能具有不同的 RAID 架构,因此请根据需要进行修改。请阅读 raidtools-0.42 附带的 man 手册和 QuickStart.RAID。
# raid-5 configuration raiddev /dev/md0 raid-level 5 nr-raid-disks 4 chunk-size 32 # Parity placement algorithm parity-algorithm left-symmetric # Spare disks for hot reconstruction #nr-spare-disks 0 device /dev/sda3 raid-disk 0 device /dev/sdb3 raid-disk 1 device /dev/sdc3 raid-disk 2 device /dev/sdd3 raid-disk 3
# raid-1 configuration raiddev /dev/md0 raid-level 1 nr-raid-disks 2 nr-spare-disks 0 device /dev/hda4 raid-disk 0 device /dev/hdc4 raid-disk 1
对于我的 RAID5 系统,我进行了完整安装
Slackware-3.4 any current distribution should work OK linuxthreads-0.71 raidtools-0.42 linux-2.0.33 with raid145 patch and Gadi's patch
创建并格式化 raid 设备。
mkraid /etc/raid5.conf mdcreate raid5 /dev/md0 /dev/sda3 /dev/sdb3 /dev/sdc3 /dev/sdd3 mdadd -ar mke2fs /dev/md0 mkdir /md mount -t ext2 /dev/md0 /md创建重启将使用的参考文件,这在您的系统上可能有所不同。
cat /proc/mdstat | grep md0 > /dosa/raidboot/raidgood.ref cat /proc/mdstat | grep md0 > /dosb/raidboot/raidgood.ref使用 Slackware-3.4 或其他发行版来构建您的操作系统
setup指定 '/md' 作为目标,以及您通常使用的源。选择并安装您感兴趣的磁盘集,内核除外。配置系统,但跳过关于 lilo 和内核启动的部分。退出设置。
安装 'pthreads'
cd /usr/src/linuxthreads-0.71编辑 Makefile 并指定
BUILDIR=/md make make install安装 'raidtools'
cd /usr/src/raidtools-0.42 configure --sbindir=/md/sbin --prefix=/md/usr修复 raidtools make install 错误
cd /md/sbin rm mdrun rm mdstop ln -s mdadd mdrun ln -s mdadd mdstop创建 /dev/mdx
cp -a /dev/md* /md/dev从当前系统添加系统配置(忽略错误)。
cp -dp /etc/* mnt/etc cp -dp /etc/rc.d/* mnt/etc/rc.d (include the new rc.6) mkdir mnt/lib/modules cp -a /lib/modules/2.x.x mnt/lib/modules <--- your current 2.x.x编辑以下文件以针对您的文件系统进行更正
cd /md Non-network etc/fstab correct for real root and raid devices. etc/mdtab should work OK Network etc/hosts etc/resolv.conf etc/hosts.equiv and related files etc/rc.d/rc.inet1 correct ip#, mask, gateway, etc... etc/rc.d/rc.S remove entire section on file system status from: # Test to see if the root partition isread-only to but not including: # remove /etc/mtab* so that mount will ..... This avoids the annoying warning that the ramdisk is mounted rw. etc/rc.d/rc.xxxxx others as required root/.rhosts if present home/xxxx/xxxx others as required WARNING: The above procedure moves your password and shadow files onto the new file system!!!!! WARNING: You may not wish to do this for security reasons.创建挂载 /dev/disk... 所需的任何目录,这些目录可能对您的系统是唯一的。我的需要
cd /md <--- new file system root mkdir dosa dos partition mount point mkdir dosb dos mirror mount point新的文件系统已完成。确保将 md 参考状态保存到“真实”根设备,即可启动。
将 dos 分区挂载到 dosa 和 dosb
cat /proc/mdstat | grep md0 > /dosa/raidboot/raidgood.ref cat /proc/mdstat | grep md0 > /dosb/raidboot/raidgood.ref mdstop /dev/md0