Article Directory
1. Build a soft RAID5 disk array
(1) Demand description
Add 4 SCSI hard disks to the Linux server.
Use the mdadm software package to build a RAID5 disk array to improve the performance and reliability of disk storage
(2) Operation steps:
1. First add 4 40G hard disks when the virtual machine is off
2. After starting the virtual machine, use the fdisk -l command to check whether the 4 fast hard disk you added has been added successfully
3. Then use the rpm -q mdadm command to check whether the software package madam needed to create the disk array has been installed. If it is not installed, use the yum install -y madam command to install the package.
4. Then partition and change the file type of the four hard disks created. Use fdisk /dev/sdb to modify the first hard disk sdb, "n" to create a partition, "p" to create a primary partition, and then just press the Enter key directly after Start and Last. Then press the "t" key to change the file type to raid, and the code is "fd".
5. Then you can use the "p" key to check and find that it has been modified successfully. Then "w" key to save.
6. Several other disks also use the same commands to create partitions and change types.
Then use the mdadm -E /dev/sd[be]1 command to check whether the four disks have been RAID, and found that they have not been RAID
7. Next, create a RAID device. -C is to create a new RAID, -v is detailed information, /dev/md5 is to name the RAID md5, -l5 (lowercase letter l in English) is to specify the RAID level, l5 to create RAID5, -n3 to specify the use of 3 blocks Hard disks create RAID, /dev/sd[bd]1 is the designated three hard disks, -x: Specify several hard disks to be used as hot spare disks for RAID, x1 means to reserve 1 free hard disk as a spare, /dev/sde1 is Specify the sde1 hard disk as the hot spare disk.
8. Use cat /proc/mdstat to view the progress of RAID creation, if [UUU] appears, it means that the RAID has been created
9. Then use mdadm /dev/md5 -f /dev/sdc1 to simulate /dev/sdc1 failure
10. Then use the cat /proc/mdstat command to check the progress of the RAID, and find that it has become [U_U], indicating that only two hard drives are working. And the server is backing up.
11. Or you can use the mdadm -D /dev/md5 command to check the RAID status, and find that sdc1 is in the faulty state, indicating that the created RAID is available.
12. Finally, create an md5 directory under the root directory, and then format the RAID, because the RAID created before is named md5. So use mkfs.xfs /dev/md5 for formatting.
13. Finally, create and mount the file system. Pay attention to why the capacity of md5 is 80G, instead of the total capacity of 4 hard disks of 120G, because it was said in theory that the utilization rate of RAID is 2/3, so it is 80G.
2. Build a soft RAID10 disk array
(1) Demand description
Add 4 SCSI hard disks to the Linux server
Use mdadm software package to construct RAID10 disk array to improve the performance and reliability of disk storage
(2) Operation steps:
Steps 1, 2, 3, 4, 5, and 6 of creating RAID10 are the same as the previous steps of creating RAID5, just look at the same operation as the above steps.
The point to note here is that to create RAID10, you need to create two RAID1 first, allocate two hard disks in each RAID1, and then create RAID0, and configure the two created RAID1 to achieve the function of RAID10.
6. Create two RAID1, named md1 and md2 respectively
7. You can use this command to view the detailed information of the RAID disk
8. Use this command to check whether the disk has been RAID
9. Create RAID0, name it md10, and specify md1 and md2 in RAID1 as RAID0
10. Check the detailed information of the disk
11. Enter the root directory to create a directory md10, format the RAID10 md10 and mount it in the md10 directory, and then you can read and write in the array