Server hardware and RAID configuration combat in Linux

For the technical documentation of creating RAID5 and RAID10, please refer to my other blog: https://blog.csdn.net/Gengchenchen/article/details/110143039

1. RAID disk array

(1) Introduction to RAID disk array

1. It is the abbreviation of Redundant Array of Independent Disks, which is abbreviated as Independent Redundant Disk Array in Chinese.
2. Combining multiple independent physical hard disks in different ways to form a hard disk group (logical hard disk), thus providing higher than a single hard disk provide data storage performance and backup technology
3, a disk array composed of different ways known as RAID level (RAID levels)
. 4, conventional RAID level
RAID0, RAID1, RAID5, RAID6, RAID1 + 0, etc.

Common disk array diagram:
Insert picture description here

(2) Introduction to RAID 0 disk array

1. RAID 0 (striped storage)

1) RAID 0 continuously divides data in units of bits or bytes, and reads/writes on multiple disks in parallel, so it has a high data transfer rate, but it has no data redundancy.
2) RAID 0 is simply improved Performance does not provide a guarantee for the reliability of data, and one of the disk failures will affect all data
3), RAID 0 cannot be used in occasions with high data security requirements
Insert picture description here

(3) Introduction to RAID 1 disk array

1. RAID 1 (mirrored storage)

1) Data redundancy is achieved through disk data mirroring, and data that is mutually backed up is generated on a pair of independent disks.
2) When the original data is busy, data can be read directly from the mirror copy, so RAID 1 can improve read Take performance
3). RAID 1 has the highest unit cost in the disk array, but it provides high data security and availability. When a disk fails, the system can automatically switch to read and write on the mirror disk without reorganizing the failed data

Insert picture description here

(4) Introduction to RAID 5 disk array (the most used in the current production environment)

1、RAID 5

1), N (N>=3) disks form an array, one piece of data generates N-1 stripes, and one copy of parity data. A total of N pieces of data are stored cyclically and evenly on N disks
2), N disks read and write at the same time, the read performance is very high, but due to the problem of the check mechanism, the write performance is relatively low
3), (N-1) / N disk utilization
4), high reliability, allow 1 bad block Disk, does not affect all data
Insert picture description here

(5) Introduction to RAID 6 disk array

1、RAID 6

1) N (N>=4) disks form an array, (N-2) / N disk utilization
2) Compared with RAID 5, RAID 6 adds a second independent parity information block
3) , Two independent parity systems use different algorithms, even if two disks fail at the same time, it will not affect the use of data.
4) Compared with RAID 5, there is greater "write loss"
Insert picture description here

(6) Introduction to RAID 1+0 disk array

1. RAID 1+0 (Mirror image first, then stripe)

1)、N (偶数,N>=4) 块盘两两镜像后,再组合成一个RAID 0
2)、N/2 磁盘利用率
3)、N/2 块盘同时写入,N块盘同时读取
4)、性能高,可靠性高

Insert picture description here

2. RAID0 RAID 0+1 (stripe first, then mirror)

1)、读写性能与RAID 10 相同
2)、安全性低于RAID 10

Insert picture description here

(7) The difference between RAID0, 1, 5, 6, 10

RAID level Number of hard drives Disk utilization Is there a check? Protection ability Write performance
RAID0 N N no no N times of a single hard drive
RAID1 N (even number) N/2 no Allow a device failure Need to write two pairs of storage devices, each as a backup
RAID5 N>=3 (N-1) /N Have Allow a device failure Need to write calculation check
RAID6 N>=4 (N-2)/N Have Allow two device failures Need to double write calculation verification
RAID10 N>=4 (even number) N/2 no Allow one of the two basis sets to be bad N/2 disks simultaneously write

Second, the array card

(1) Introduction to the array card

1. The array card is a board used to realize the RAID function.
2. It is usually composed of a series of components such as I/0 processor, hard disk controller, hard disk connector and cache.
3. Different RAID cards support different RAID functions.
For example, support RAID0, RAID1, RAID5, RAID10, etc.
4. The interface type of the RAID card
IDE interface, SCSI interface, SATA interface and SAS interface

(2) Cache of array card

1. Cache is the place where the RAID card exchanges data with the external bus. The RAID card first transfers the data to the cache, and then exchanges data between the cache and the external data bus.
2. The size and speed of the cache are directly related to the reality of the RAID card. Important factors for transmission speed
3. Different RAID cards are equipped with different memory capacities when they leave the factory, generally ranging from several megabytes to hundreds of megabytes.

The picture of the array card is as follows:
Insert picture description here

3. Steps to create a soft RAID disk array:

1. Check whether the mdadm package has been installed

rpm   -q   mdadm
yum  install  -y  mdadm

2. Use fdisk tool to manage disk partitions

/dev/sdb, /dev/sdc, /dev/sdd, /dev/sde divide the primary partitions sdb1, sdc1, sdd1, sde1, and change the ID mark number of the partition type to "fd"

fdisk  /dev/sdb
fdisk  /dev/sdc

3. Create a RAID device

1) Create RAID5

mdadm  -C -v  /dev/md0  [-a  yes]  -l5 -n3  /dev/sd [bcd]1  -x1  /dev/sde1

-C: means new creation
-v: displays detailed information during the creation process
/dev/mdo: creates the name of RAID5
-a yes: –auto, means that if any device file does not exist, it will be created automatically, you can omit
-l: specify RAID level, l5 means to create RAID5
-n: specify how many hard disks to create RAID, n3 means to use 3 hard disks to create RAID
/dev/sd [bcd]1: specify to use these four disk partitions to create RAID
-x: specify Use several hard disks as hot spare disks for RAID, x1 means to reserve 1 free hard disk as spare
dev/sde1: designated as a spare disk

2) Create RAID10 (mirror first, then stripe)

mdadm   -Cv   /dev/md0   -l1  -n2   /dev/sd [bc]1
mdadm   -Cv   /dev/md1   -l1  -n2   /dev/sd [de]1
mdadm   -Cv   /dev/md10  -l0   -n2   /dev/md0   /dev/md1

View RAID disk details

cat  /proc/mdstat         #查看创建RAID的进度
或者
mdadm   -D    /dev/md0

Check if the disk is already in RAID

mdadm   -E   /dev/sd [b-e]1

4. Create and mount a file system

mkfs   -t   xfs   /dev/md0
mkdir   /myraid
mount   /dev/md0   /myraid/
df   -Th
cp   /etc/fstab   /etc/fstab.bak
vim   /etc/fstab
/dev/md0      /myraid      xfs      defaults    0  0

5. Realize failure recovery

mdadm   /dev/md0   -f   /dev/sdb1       #模拟/dev/sdb1故障
mdadm  -D   /dev/md0            #查看发现sde1已顶替sdb1

Other common options of mdadm command

r: remove device
-a: add device
-S: stop RAID
-A: start RAID

mdadm  -S  /dev/md0
mdadm   /dev/md0   -r    /dev/sdb1

Guess you like

Origin blog.csdn.net/Gengchenchen/article/details/110140923