今天看RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302),看到software raid,有个lab,以前只做过linear的raid,现在有了qemu赶紧虚拟出4块硬盘做做喽。实验了分别用raidtool和mdadm两个工具创建各种software raid的方法,最后还试了下在raid上创建lvm,感觉不错。:)
RAID 0
This level of RAID makes it faster to read and write to the hard drives. However, RAID 0 provides no data redundancy. It requires at least two hard disks.
Reads and writes to the hard disks are done in parallel, in other words, to two or more hard disks simultaneously. All hard drives in a RAID 0 array are filled equally. But since RAID 0 does not provide data redundancy, a failure of any one of the drives will result in total data loss. RAID 0 is also known as 'striping without parity.'
特征:并行读写数据,性能高,但没有数据冗余,阵列中任何一个硬盘坏掉,意味着任何数据丢失
容量:任何硬盘容量之和
条件:至少两块硬盘,做为RAID的分区大小必须是几乎相同的.
首先将各个分区的分区类型标识为FD:
[root@LFS ~]#fdisk /dev/hda
Command (m for help):t
Partition number (1-4):1
Hex code (type L to list codes):fd
Changed system type of partition 1 to fd (Linux raid autodetect)
Command (m for help):p
/dev/hda1 1 646 325552 fd Linux raid autodetect
使用raidtools-1.00.3创建raid-0:
编写raid的配置文档/etc/raidtab:
在/usr/share/doc/raidtools-1.00.3下有样例文档
raiddev /dev/md0
raid-level 0
nr-raid-disks 2
nr-spare-disks 0
persistent-superblock 1
chunk-size 4
device /dev/hda1
raid-disk 0
device /dev/hdb1
raid-disk 1
mkraid依据raidtab创建raid:
[root@LFS ~]#mkraid /dev/md0
......
raid0: done.
raid0 : md_size is 650880 blocks
raid0 : conf ->hash_spacing is 650880 blocks
raid0 : nb_zone is 1.
raid0 : Allocating 4 byte for hash
使用mdadm创建raid-0:
[root@LFS ~]#mdadm --create --verbose /dev/md0 --level=raid0 \
--raid-devices=2 --chunk=4 /dev/hda1 /dev/hdb1
......
raid0: done.
raid0 : md_size is 650880 blocks
raid0 : conf ->hash_spacing is 650880 blocks
raid0 : nb_zone is 1.
raid0 : Allocating 4 byte for hash
mdadm: array /dev/md0 started .
[root@LFS ~]#
查看状态:
[root@LFS ~]#cat /proc/mdstat
Personalities : [raid0]
md0 : active raid0 hdb1[1] hda1[0]
650880 blocks 4k rounding
unused devices:
[root@LFS ~]#
创建文档系统,挂载:
[root@LFS ~]#mkreiserfs /dev/md0
[root@LFS ~]#mount -t reiserfs /dev/md0 /mnt/raid0
加入到/etc/fstab,系统启动自动挂载:
/dev/md0 /mnt/raid0 reiserfs defaults 1 2
Commands in raidtab
Command
Description
nr-raid-disks
Number of RAID disks to use
nr-spare-disks
Number of spare disks to use
persistent-superblock
Required for autodetection
chunk-size
Amount of data to read/write
parity-algorithm
How RAID 5 should use parity
RAID 1
This level of RAID mirrors information to two or more other disks. In other words, the same set of information is written to two different hard disks. If one disk is damaged or removed, you still have all of the data on the other hard disk. The disadvantage of RAID 1 is that data has to be written twice, which can reduce performance. You can come close to maintaining the same level of performance if you also use separate hard disk controllers. That prevents the hard disk controller from becoming a bottleneck.
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




