Raid concept – how raid-0-1-5-10 works


Raid concept – how enterprise raid-0-1-5-10 works

Redundant arrays of independent disks (RAID) are composed of “Independent Disks” with redundancy
The meaning of “array of capabilities” (one disk is broken and data is not lost). Disk array consists of many cheaper disks to hardware (RAID)
Card) or software (mdadm) forms are combined into a disk group with huge capacity, and multiple disks are combined together to improve performance
Overall disk system performance. Using this technology, the data is cut into many sections and stored on each hard disk. Disk arrays can also take advantage of parity checking
According to the concept of check), when any hard disk in the array fails, the data can still be read out, and when the data is reconstructed,
After calculation, put the data back into the new hard disk (that is, if a disk is broken, unplug and insert a new disk, the data can be restored to the new disk, and parity check is used). Note: raid
It can prevent data loss, but it can not completely guarantee that your data will not be lost, so we should pay attention to backing up important data while using raid
There are two ways to create: soft raid (implemented by operating system software) and hard raid (using hardware array card); The most used in enterprises are: RAID1, RAID5 and
raid10。 However, with the rapid development of cloud, Alibaba cloud, Tencent cloud and other suppliers can generally solve the hardware problems. (when you use the cloud, do you pay attention to the raid type used by the underlying supplier)

1.1 several common types of raid

Level ———— description —— minimum disk number rate —— space utilization —— respective advantages and disadvantages
Raid0 —————– striped volume ———————- 2 + —————- 100% ——- fast reading and writing speed, no error allowed
RAID1 —————– mirrored volume ———————- 2 ————————– 50% ——- average write speed, improved read speed, fault tolerance
RAID5 —- striped volume with parity —— 3 + —————– (n-1) / N —— fast read and write speed, fault tolerance, and one bad block is allowed
RAID5 — stripe set with parity check, double check — 4 + ————– (n-2) / N ———- fast read and write, fault tolerance, allowing two bad disks

Basic idea of raid: several hard disks are combined in a certain way to form a new hard disk array group
It can meet the requirements of high-performance hard disk
Raid has three key technologies:
Mirroring: provides data security;
Chunk stripe (block size can also be said to be the granularity of stripe), which exists to improve I / O and provide data concurrency
Data verification: ensure the reliability of data
Raid advantages over a single disk:
Raid concept - how raid-0-1-5-10 works

How 1.2 raid-0 works

Striping is also our earliest raid mode
Number of disks required: more than 2 (preferably the same size), which is the simplest form of building a disk array. Only more than 2 hard disks are required
All right

Features: low cost, which can improve the performance and throughput of the whole disk. RAID 0 does not provide redundancy or error repair capability and is fast
The damage of any disk will damage all data; Disk utilization is 100%.
Raid concept - how raid-0-1-5-10 works
Raid concept - how raid-0-1-5-10 works


Mirroring requires more than two disks
Principle: it is to mirror the data of one disk to another disk, that is, when the data is written to one disk, it will be in another disk
Generate image files on idle disks, (synchronization)

RAID 1 mirroring requires at least two hard disks, and the raid size is equal to the smallest capacity (maximum) of the two raid partitions
Well, the partition size is divided into the same) and the data is redundant. When storing, it is written to two hard disks at the same time to realize data backup;

The disk utilization rate is 50%, that is, two 100g disks constitute RAID1, which can only provide 100g of available space. As shown below
Raid concept - how raid-0-1-5-10 works
Raid concept - how raid-0-1-5-10 works


Three or more hard disks are required, and hot spare disks can be provided to recover from failure; Only one piece is damaged, no problem. But if both are damaged at the same time
Block disks, the data will be corrupted. Space utilization: (n-1) / N 2 / 3
As shown in the figure below
Raid concept - how raid-0-1-5-10 works
Role of parity information:
When a disk data of RAID5 is damaged, use the remaining data and corresponding parity information to recover the damaged data
According to.
Expansion: XOR operation
It is a relatively simple exclusive or logic operation (the same is 0 and the difference is 1)
A value ——- b value ——- XOR result
0 ————0————–0
1 ————0————–1
0 ————1————–0
1 ————1————–1

1.5 nested RAID levels

Raid-10 mirroring + striping
Raid 10 is a RAID level that combines mirroring and striping at two levels. The first level is RAID1 mirror pair and the second level is raid
0 For example, we have 8 disks, which are mirrored in pairs to form a new 4 disks, and then raid0 for these 4 disks; When
One hard disk of RAID10 is damaged, and the other hard disks will continue to work. At this time, only two hard disks are affected
Raid concept - how raid-0-1-5-10 works
Compared with several schemes, RAID5 is the most suitable, as shown in the following figure:
Raid concept - how raid-0-1-5-10 works

1.6 raid hard disk failure handling

Generally, there are two processing methods: hot standby and hot plug
Hot standby: hotspare

Definition: when a hard disk in a redundant raid group fails, it is used without disturbing the normal use of the current RAID system
Another normal standby hard disk in the RAID system automatically replaces the failed hard disk to ensure the redundancy of the RAID system in time (just like the one on the car)
Spare wheel)

Global: the spare hard disk is shared by all redundant raid groups in the system (one spare tire for multiple vehicles)
Dedicated: the spare hard disk is dedicated to a group of redundant raid groups in the system (one spare tire for each vehicle)
As shown in the figure below, it is an example of a global hot spare, which is shared by two raid groups in the system and can automatically replace any one
A failed hard disk in raid
Raid concept - how raid-0-1-5-10 works
Hot swap: HotSwap
Definition: replace the failed hard disk in the RAID system with a normal physical hard disk without affecting the normal operation of the system. (the light turns red
If a hard disk fails, unplug it directly and plug in a new one. The server should support hot plug (HotSwap)

God of learning, I want to know more about the official account.
Raid concept - how raid-0-1-5-10 works