[root@localhost etc]# cp /usr/share/doc/raidtools-1.00.3/raid0.conf.sample /etc/raidtab
[root@localhost etc]# cat /etc/raidtab #拷贝和编辑raid0的配置文件
# Sample raid-0 configuration
raiddev /dev/md0
raid-level 0 # raid级别
# right after raiddev
persistent-superblock 0 # set this to 1 if you want autostart,
# BUT SETTING TO 1 WILL DESTROY PREVIOUS
# CONTENTS if this is a RAID0 array created
# by older raidtools (0.40-0.51) or mdtools!
chunk-size 16
nr-raid-disks 2 #需要的磁盘数量
nr-spare-disks 0
device /dev/hda1
raid-disk 0
device /dev/hdb1
raid-disk 1
[root@localhost etc]# mkraid /dev/md0 #创建md0文件
[root@localhost etc]# mkfs.ext3 /dev/md0 #格式化md0文件
mke2fs 1.39 (29-May-2006)
mkfs.ext3: Device size reported to be zero. Invalid partition specified, or
partition table wasn't reread after running fdisk, due to
a modified partition being busy and in use. You may need to reboot
to re-read your partition table.
[root@localhost etc]# mount /dev/md0 /opt #mount到某个目录下
mount: you must specify the filesystem type #将raid0自动挂载
[root@localhost etc]# vi fstab
......
/dev/md0 /opt ext3 defaults 0 0
[root@localhost etc]# raidstop /dev/md0
[root@localhost etc]# lsraid -A -a /dev/md1 #检查raid设备状态
lsraid: md device [dev 9, 1] /dev/md1 is offline: Please specify a disk to query