Linux下实现raid5磁盘阵列

一.做raid5磁盘阵列

fdisk -l                                                                  //列出所有磁盘分区

fdisk /dev/sdh    m查看各种参数(n,1...4,p,初始值,结束值,t,fd,p,w等)     //给新硬盘分区,sdh1,sdh2,sdh3,sdh4(大小一致)

partprobe                                                                 //激活分区

mdadm -Cv /dev/md0 -l5 -n3 -x1 -c128 /dev/sdh[1,2,3,4]                    //创建raid5阵列磁盘

more /proc/mdstat                                                         //查看阵列状态

/****************************************************出现则完成****************************************************/

Personalities : [raid5]

md0 : active raid5 sdd1[2] sde1[3] sdc1[1] sdb1[0]

75469842 blocks level 5, 128k chunk, algorithm 2 [3/3] [UUU]

unused devices:

/******************************************************************************************************************/

mdadm -Ds > /etc/mdadm.conf                                               //生成raid配置文件

(mkfs.ext3 /dev/md0                                                       //磁盘阵列md0创建文件系统

mkdir /mnt/raid                                                          //创建挂载点

mount /dev/md0 /mnt/raid                                                 //挂载

vi /etc/fstab                                                            //自动挂载   

/dev/md0 /mnt/raid ext3 defaults 0 0)

二.在raid上建lvm 

pvcreate -f /dev/md0                                                      //划分pv

vgcreate vgdata /dev/md0                                                  //建vg    (此刻vgdata在/etc/lvm下)

lvcreate -L 1000m -n lvdata /dev/vgdata                                   //建lv    (此刻vgdata在/dev下)

mkfs.ext3 /dev/vgdata/lvdata                                              //lv创建文件系统

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/09e5d689f21b97841e9d862fded60837.html