Creation and example of RAID5 in raid

Source: Internet
Author: User

RAID
1) RAID supports dynamic capacity expansion

2)RAID支持磁盘加速3)RAID支持冗余

RAID 5: Requires more than three hard drives, disk capacity of multiple disks-1, to provide some disk speed and redundancy (fatal disadvantage: Generate checksum when the use of additional computing resources), allow damage to a hard disk

The command used to create the raid is mdadm, if not, install the mdadm package First

[[email protected]_01 ~]# mdadm -Cv /dev/md0 -a yes -n3 -l5 -x1 /dev/sd[c-f]  //创建raid5

Parameter explanation:

    --create               //表示要创建raid    --auto=yes /dev/md0    //是否自动检测,新建立的软件磁盘陈列设备为md0,md序号可以为0-9    --level=5               //磁盘阵列的等级,这里是raid5    -raid-devices           //所需使用的磁盘数量    --spare-devices          //添加作为预备(spare)磁盘的块数    /dev/sd[b-e]           //磁盘阵列所使用的设备,还可以写成“/dev/sdb /dev/sdc /dev/sdd /dev/sde”同样可以缩写为:mdadm –C –a yes /dev/md0 –l5 –n3 –x1 /dev/sd[b-e]    [[email protected]_01 ~]# mkfs.ext4 /dev/md0                      //将raid5格式化

    [[email protected]_01 ~]# mkdir /raid    [[email protected]_01 ~]# mount /dev/md0 /raid                    //创建并挂载           [[email protected]_01 ~]# df –Th                                 //查看挂载情况

    [[email protected]_01 ~]# mdadm --detail --scan>/etc/mdadm.conf  //全部追加到配置文件中    [[email protected]_01 ~]# vim /etc/mdadm.conf                     //编辑配置文件

    [[email protected]_01 ~]# vim /etc/fstab                            //编辑配置文件

    在里面加上一行     /dev/md0   /raid     ext4     defaults    0   0

Simulated disk corruption

[[email protected]_01 ~]# mdadm /dev/md0 -f /dev/sdd               //模拟磁盘损坏[[email protected]_01 ~]# cat /proc/mdstat                          //查看修复


RAID5 recovered.

[[email protected]_01 ~]# mdadm /dev/md0 -r /dev/sdd            //把坏的磁盘移除

Command parameters

-A  =  --assemble      激活-S  =  --stop           停止-D  =  --detail          查看raid详细信息-C  =  -- create         建立raid设备-v  =  --verbose        显示建立过程的详细信息-l  =  --level            raid的级别-n  =  --raid-devices    raid设备数-s  =  --scan            扫描raid设备-f  =  --fail              标示坏的硬盘-a  =  --add             添加硬盘-r  =  -remove           移除坏的硬盘

how to turn off RAID :

>>直接卸载/dev/md0,并且注释掉/etc/fstab文件中的配置umount  /dev/md0                  //解除挂接vi  /etc/fstab                      //将fstab里面的开机自动挂载注释掉#/dev/md0     /var/www/html     ext4     defaults         0   0mdadm --stop /dev/md0           //停止md0磁盘服务

Two ways to see if a raid was created successfully

cat  /proc/mdstatmdadm  --detail  /dev/md

Creation and example of RAID5 in raid

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.