Understanding of RAID
RAID 0
RAID 1
RAID 2
RAID 5 (distributed read-write and parity calculation)
RAID 6 (distributed read-write and parity information)
![Insert picture description here](https://img-blog.csdnimg.cn/20201224120215783.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NTg0OTA2Ng==,size_16,color_FFFFFF,t_70)
RAID comparison
![Insert picture description here](https://img-blog.csdnimg.cn/20201224122004981.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NTg0OTA2Ng==,size_16,color_FFFFFF,t_70)
MDADM
Create raid 0
1. Add 4 hard disks (custom size)
2. Create raid 0 (after successful creation, the following message is displayed as success)
-C: create a new RAID
-a: automatically create the corresponding device
-l specify the RAID level to be created
-n: Specify the number of hard disks
/dev/md0: path
/dev/sdb and /dev/sdc: two devices
0: raid level
![Insert picture description here](https://img-blog.csdnimg.cn/20201224124329958.png)
3. View the detailed information of the created disk: madam -D /dev/md0
4. Create A configuration file makes the created raid take effect permanently:
![Insert picture description here](https://img-blog.csdnimg.cn/2020122412545561.png)
3. Create a file system for permanent mounting:
a. Format the file system with md0 as ext4: mkfs -t ext4 /dev/md0
b. Create a mount point: mkdir /mnt/ raid0
c. Mount: mount /dev/md0/ /mnt/raid0/
d. View: df -hT
e. Copy the file (pay attention to the path):
![Insert picture description here](https://img-blog.csdnimg.cn/20201224130128285.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NTg0OTA2Ng==,size_16,color_FFFFFF,t_70)
4. Modify the fstab file (the last line is the added information section to achieve permanent mounting Upload):
vim /etc/fstab
![Insert picture description here](https://img-blog.csdnimg.cn/2020122413030235.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NTg0OTA2Ng==,size_16,color_FFFFFF,t_70)
Create and backup disks of other raid levels
Control RAID
1. Uninstall and then close (this operation restart will also start raid):
umount /dev/md0
madam -S /dev/md0
2. Clear the RAID information on the underlying disk of the RAID
mdadm --zero-superblock /dev/sdb
Creation of RAID 5 (use one of the hard drives as backup hard drives at the same time)
1. Create and backup disk
2. View detailed information: mdadm -D /dev/md0