1.新添加一块磁盘
2.进行强制扫描
[root@localhost ~]# echo "- - -" >> /sys/class/scsi_host/host0/scan [root@localhost ~]# echo "- - -" >> /sys/class/scsi_host/host1/scan [root@localhost ~]# echo "- - -" >> /sys/class/scsi_host/host2/scan
3.使用gdisk /dev/sdb命令进行分区
4.创建raid0
[root@localhost ~]# mdadm -C /dev/md0 -a yes -l 0 -n 2 /dev/sdb{1,2}
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
5.查看当前系统上启用的raid设备
[root@localhost ~]# cat /proc/mdstat Personalities : [raid0] md0 : active raid0 sdb2[1] sdb1[0] 2093056 blocks super 1.2 512k chunks unused devices:
6.格式化
[root@localhost ~]# mkfs.xfs /dev/md0 meta-data=/dev/md0 isize=512 agcount=8, agsize=65408 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=523264, imaxpct=25 = sunit=128 swidth=256 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=8 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0
7.挂载
[root@localhost ~]# mkdir /mnt/Raid0 [root@localhost ~]# mount /dev/md0 /mnt/Raid0/ [root@localhost ~]# mount | tail -1 /dev/md0 on /mnt/Raid0 type xfs (rw,relatime,seclabel,attr2,inode64,sunit=1024,swidth=2048,noquota) [root@localhost ~]# df -hT /mnt/Raid0/ Filesystem Type Size Used Avail Use% Mounted on /dev/md0 xfs 2.0G 33M 2.0G 2% /mnt/Raid0
8.使用gdisk /dev/sdb命令分区
Number Start (sector) End (sector) Size Code Name 1 2048 2099199 1024.0 MiB FD00 Linux RAID 2 2099200 4196351 1024.0 MiB FD00 Linux RAID 3 4196352 8390655 2.0 GiB FD00 Linux RAID 4 8390656 12584959 2.0 GiB FD00 Linux RAID
9.使用mdadm命令创建raid1
[root@localhost ~]# mdadm -C /dev/md1 -a yes -l 1 -n 2 /dev/sdb{3,4}
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md1 started.
[root@bash ~]# cat /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid1 sdb4[1] sdb3[0]
2094080 blocks super 1.2 [2/2] [UU]
[==>..................] resync = 14.5% (305536/2094080) finish=0.2min
speed=101845K/sec
md0 : active raid0 sdb2[1] sdb1[0]
2093056 blocks super 1.2 512k chunks
unused devices:



