RAID 5 and RAID 10 creation process

RAID 5 and RAID 10 creation

1. RAID 5

(1) First, when the virtual machine is closed, add 4 40G hard disks (the size of the newly added hard disk can be any size, but the capacity of the four hard disks must be the same).
Insert picture description here
Use the "fdisk -l" command to check and find that the hard disk has been added successfully
Insert picture description here
(2 ) Use the "rpm -q madam" command to check whether the software package mdadm needed to create a disk array has been installed.
Insert picture description here
If it is not installed, use the "yum install -y mdadm" command to install the software package
Insert picture description here
(3) and then partition and modify the file types of the four hard disks created. Use "fdisk /dev/sd" to modify the four hard disks
"n" to create a partition
"p" to create a primary partition, and
then press Enter three times (because it is an experiment, the disk capacity can be directly assigned to the primary partition) and
then press The "t" key changes the file type to RAID type, and the code is "fd".
Remember to "w" to save after changing

Insert picture description here
You can use the "mdadm -E /dev/sd[be]1" command to check whether the four disks have been RAID
Insert picture description here
(4) Next, create a RAID 5 device
"-C" is a new RAID
"v" is the detailed information
"/ "dev/md5" is to name this RAID md5
"-l5" (lowercase letter l in English) means to create RAID5
"-n3" means to use 3 hard disks to create RAID
"/dev/sd[bd]1" means to specify sdb1 , Sdc1, sdd1 hard disk to create RAID
"-x1" means to reserve a free hard disk as a spare
"/dev/sde1" means to designate sde1 hard disk as a hot spare disk.
Insert picture description here
You can use "cat /proc/mdstat" to view the progress of RAID creation. If [UUU] appears, the RAID has been created

Insert picture description here
(5) Use "mdadm /dev/md5 -f /dev/sdc1" to simulate /dev/sdc1 failure.
Insert picture description here
Insert picture description here
Use the "cat /proc/mdstat" command to check the progress of the RAID and find that it has become [U_U]. Only two hard drives are working, and the server is backing up.
Insert picture description here
You can also use the "mdadm -D /dev/md5" command to view the RAID, and find that sdc1 is in a faulty state, indicating that the created RAID can run normally
Insert picture description here
Insert picture description here
(7) Finally, create a md5 directory under the root directory, and then perform RAID Format, because the RAID created before is named md5,
use "mkfs.xfs /dev/md5" to format
Insert picture description here
(8) Finally, create and mount the file system

Insert picture description here
Insert picture description here

Insert picture description here
The disk capacity here is 80G instead of 160G, because there is a disk that does a hot backup and does not count, and the disk utilization of RAID 5 is 2/3, so it is 80G

Two, RAID 10

(Refer to the creation of RAID 5 for the first three steps) To
create RAID 10, you need to create two RAID 1 first, allocate two hard disks in each RAID 1, then create RAID 0, and finally configure the two created RAID 1s. Can reach the function of RAID10

(4) Create two RAID1, named md1 and md2 respectively
Insert picture description here

Insert picture description here
"Mdadm -D /dev/md1" command can view the detailed information of RAID disks
Insert picture description here
"mdadm -E /dev/sd[be]1" command to check whether these four disks have been RAID

Insert picture description here
(5) The next step is to create a RAID 5 device
"-C" is to create a new RAID
"v" is the detailed information
"/dev/md10" is to name this RAID md10
"-l0" (English lowercase letter l) means to create RAID 0
" "-n2" is to specify the use of 2 hard disks to create RAID (four hard disks create two RAID 1, which can be regarded as two overall hard disks)
"/dev/md1 /dev/md2" means specifying md1 and md2 to create RAID 0
Insert picture description here
" mdadm -D /dev/md10 "Check the detailed information of the disk.
Insert picture description here
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
Insert picture description here

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_51613313/article/details/110220117