配置Linux软RAID0
[root@RHEL7 ~]# mdadm -C -v /dev/md0 -l 0 -n 2 /dev/sdb /dev/sdc
[root@RHEL7 ~]# mdadm -C -v /dev/md0 -l 0 -n 2 /dev/sdb /dev/sdc
mdadm: chunk size defaults to 512K
mdadm: /dev/sdb appears to be part of a raid array:
level=raid0 devices=0 ctime=Thu Jan 1 08:00:00 1970
mdadm: partition table exists on /dev/sdb but will be lost or
meaningless after creating array
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
[root@RHEL7 ~]#
[root@RHEL7 ~]# mdadm -Ds
ARRAY /dev/md0 metadata=1.2 name=RHEL7.2:0 UUID=cf8fac13:5d74d4da:d142582c:567b346b
[root@RHEL7 ~]# mdadm -Ds > /etc/mdadm.conf
[root@RHEL7 ~]#
[root@RHEL7 ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Wed Aug 17 21:19:31 2016
Raid Level : raid0
Array Size : 10484736 (10.00 GiB 10.74 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Wed Aug 17 21:19:31 2016
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Chunk Size : 512K
Name : RHEL7.2:0 (local to host RHEL7.2)
UUID : cf8fac13:5d74d4da:d142582c:567b346b
Events : 0
Number Major Minor RaidDevice State
0 8 16 0 active sync /dev/sdb
1 8 32 1 active sync /dev/sdc
[root@RHEL7 ~]#
[root@RHEL7 ~]# mkfs -t xfs -f /dev/md0
log stripe unit (524288 bytes) is too large (maximum is 256KiB)
log stripe unit adjusted to 32KiB
meta-data=/dev/md0 isize=256 agcount=16, agsize=163712 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0
data = bsize=4096 blocks=2619392, imaxpct=25
= sunit=128 swidth=256 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
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
[root@RHEL7 ~]# mount /dev/mp0 /raid0
[root@RHEL7 ~]# vim /etc/fstab
/dev/md0 /raid0 defaults 0 0
[root@RHEL7 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 9.8G 3.3G 6.5G 34% /
devtmpfs 908M 0 908M 0% /dev
tmpfs 914M 80K 914M 1% /dev/shm
tmpfs 914M 8.9M 905M 1% /run
tmpfs 914M 0 914M 0% /sys/fs/cgroup
/dev/sda1 197M 91M 106M 47% /boot
/dev/md0 10G 33M 10G 1% /raid0
查看目录容量
[root@RHEL7 ~]# du -sh /raid0
0 /raid0
[root@RHEL7 ~]# mdadm -r /dev/md0 /dev/sdc
mdadm: hot remove failed for /dev/sdc: Device or resource busy
[root@RHEL7 ~]#
[root@RHEL7 ~]# cat /proc/mdstat
Personalities : [raid0]
md0 : active raid0 sdc[1] sdb[0]
10484736 blocks super 1.2 512k chunks
unused devices: <none>
[root@RHEL7 raid0]# blkid[root@RHEL7 raid0]# blkid[root@RHEL7 raid0]# blkid
/dev/md0: UUID="20fefde8-3544-436a-9d48-28ce3863539e" TYPE="xfs"