Software RAID 0, software RAID
Implementation of Software RAID 0
RAID 0, also known as Stripe or Striping, represents the highest storage performance in all RAID levels. RAID 0 improves storage performance by distributing continuous data to multiple disks for access. In this way, the system can execute data requests on multiple disks in parallel, each disk executes its own data request. This type of parallel operations on data can make full use of the bandwidth of the bus, significantly improving the overall disk access performance.
RAID 0 does not provide data redundancy. Therefore, damaged data cannot be recovered once the user data is damaged. When RAID0 is running, if any of the hard disks fails, the entire data may fail. Enterprise Users are generally not recommended to use it independently.
RAID 0 has the characteristics that make it especially suitable for fields that require high performance but do not care much about data security, such as workstations. For individual users, RAID 0 is also an excellent choice for improving hard disk storage performance.
You can use the entire hard disk or partition for raid0. The partition is used here.
1 partition
Create two new partitions:/dev/sda6/dev/sda7.
Note: Change the partition ID to fd.
Synchronize partitions
[root@centos7 ~]# partprobe
2 create RAID 0
[root@centos7 ~]# mdadm -C /dev/md0 -a yes -l 0 -n 2 /dev/sda6 /dev/sda7mdadm: Defaulting to version 1.2 metadatamdadm: array /dev/md0 started.
Created successfully,
-C: Create a new disk array. Specify the device name as md0,
-A {yes | no}: automatically creates the device file of the target RAID device.
-L specifies the RAID level. Here, the value is 0.
-N: Number of disks in the array
The new device name is/dev/md0. This device can be used like a partition. You can create a file system, mount the device, and then use it normally.
3. Create a File System
[root@centos7 ~]# mkfs.ext4 /dev/md0
View Devices
[root@centos7 ~]# blkid[……]/dev/sr0: UUID="2016-12-05-13-52-39-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos"/dev/sda6: UUID="70b40ab3-f5ba-2412-df4d-d159d01e22ae" UUID_SUB="7ebe1427-b452-8a91-1c46-03f8a47e17e7" LABEL="centos7.3.loacl:0" TYPE="linux_raid_member"/dev/sda7: UUID="70b40ab3-f5ba-2412-df4d-d159d01e22ae" UUID_SUB="b946d93b-6b3e-c5cb-f10e-ce43c4d25774" LABEL="centos7.3.loacl:0" TYPE="linux_raid_member"/dev/md0: UUID="7fa669ed-fc90-4ecc-a7a7-a49997f23c06" TYPE="ext4"
We can see that the UUID and/dev/md0 of/sda6 and/sda7 are the same.
4 Mount
[root@centos7 ~]# mkdir /mnt/md0[root@centos7 ~]# mount /dev/md0 /mnt/md0/
View mounting information
[root@centos7 /mnt/md0]# df -h /dev/md0Filesystem Size Used Avail Use% Mounted on/dev/md0 2.0G 6.0M 1.9G 1% /mnt/md0
Set boot mounting
[root@centos7 ~]# blkid /dev/md0/dev/md0: UUID="7fa669ed-fc90-4ecc-a7a7-a49997f23c06" TYPE="ext4"[root@centos7 ~]# vim /etc/fstabUUID=dddd23d1-1012-4bac-9717-56b9b469e0c2 / ext4 defaults 1 1UUID=316d8677-25b8-49af-b4eb-54daa20b6595 /boot ext4 defaults 1 2UUID=dacd6ddd-d765-4646-b98c-0579f2732749 swap swap defaults 0 0UUID=7fa669ed-fc90-4ecc-a7a7-a49997f23c06 /mnt/md0 ext4 defaults 0 0
5. View Details of raid0 (/dev/md0 ).
[root@centos7 ~]# mdadm -D /dev/md0/dev/md0:Version : 1.2Creation Time : Tue Apr 25 11:51:21 2017Raid Level : raid0Array Size : 2095104 (2046.00 MiB 2145.39 MB)Raid Devices : 2Total Devices : 2Persistence : Superblock is persistentUpdate Time : Tue Apr 25 11:51:21 2017State : cleanActive Devices : 2Working Devices : 2Failed Devices : 0Spare Devices : 0Chunk Size : 512KName : centos7.3.loacl:0 (local to host centos7.3.loacl)UUID : 70b40ab3:f5ba2412:df4dd159:d01e22aeEvents : 0Number Major Minor RaidDevice State0 8 6 0 active sync /dev/sda61 8 7 1 active sync /dev/sda7