Recently, I was thinking about a cheap and convenient way to integrate cinder with LVM driver, that is, a raid hard disk consisting of cinder + LVM + multiple disks. In this case, you need to consider what raid should be used based on read/write requirements and available resources, and how to choose the raid mode. There are two raid Methods: hardware raid and software raid, by the way, draw some figures (the number of hard disks used in the figure is the minimum number of hard disks required in the raid) To summarize the RAID technologies.
Soft Raid and hard raid
Hard raid can be understood as a RAID card. The RAID card can be used to manage multiple disks and form a raid Redundant Array. The key to combining multiple disks into raid is how the RAID card implements addressing.
Soft Raid uses software at the operating system level to implement raid. For example, we are familiar with the MD software in Linux and the Command Behavior mdadm. The advantage of Soft Raid is that you do not need to pay for raid cards, however, soft RAID consumes memory, and the performance is not as good as hardware raid, and features are not as good as hardware raid.
Next we will introduce various RAID technologies
I. RAID 0
The band technology is used to write data in parallel on multiple disks in bytes or bits (the starting offset of each disk is the same, and the subsequent segments of a certain number of bytes, i/O read/write performance can be improved, but it does not have data redundancy like raid1. Once the hard disk fails, it will be done. The structure is as follows.
Ii. Raid 1
The image technology is used to copy data on another disk each time it is written. This is used for Disaster Tolerance and the write performance is reduced. The data structure is as follows:
Iii. Raid 2
First, we adopt the strip technology and add redundant disks to store the data for each bit for hamming code encoding. This allows us to implement checksum and error correction, A power block of 2 needs to be used as a data disk for verification. The structure is as follows:
4. RAID 3
Using the strip technology, write data in bytes as partitions, and add a disk to store the parity bit data. When a data disk breaks down, you can re-mount the disk to restore data by verifying the disk and other data disks. The structure is as follows:
5. Raid 4
First, why does raid4 exist to improve the concurrency probability? Based on raid3, it uses a larger partition to write data as a unit. Why should it increase the size of the data block to be written, assume that data of A and B is written to the first disk in raid3, and data of A is occupying the verification disk, data of B needs to wait, which increases the data size, then a and B may be able to form a large block for writing together, which is to achieve this pseudo-concurrency. This raid requires data optimization when data is written in the early stage. raid4. generally, raid4 is rarely used in the netapp wafl file system.
Vi. RAID 5
RAID 5 uses real concurrency I/O and does not have hotspot disks like raid3. it evenly distributes parity data to multiple magnetic disks, how can I/O be improved? For example, if there are four disks, assume that the verification zone is in the second disk when the first disk is written to data, at this time, the third and fourth disks are idle. When B data is written to the third Disk in a certain band, and B data is checked in the fourth disk, in this way, both data a and data B can be read and written at the same time.
VII. Raid 6
Raid 6 adds a verification area on the basis of RAID 5, each of which has two verification areas. They use an unused verification algorithm to improve data reliability.
Next we will introduce several types of combined raid
1. raid01
The total number of disks is N, and RAID 0 is performed on each n/2 disks. Taking four disks as an example, there are images with strip, but the redundancy is not as good as raid 10. Next, we will summarize in raid 10.
Ii. raid10
Write Data in sequence to D1, D2, D3, D4, and distribution of data blocks. In fact, RAID 0 is equivalent to an odd disk, and an even disk is used as a backup of an odd disk. Compared with raid01, the advantage is that data can be read and written normally as long as the two disks of the image are not damaged at the same time. In raid 01, a bad data disk composed of RAID 0 cannot be used. It requires that a group of disks composed of RAID 0 be read and written properly after completion. Taking the four disks shown in the figure as an example, raid10 can accept {1, 3} {1, 4} {2, 3} {2, 4} Bad disks, raid01 can only accept damages from {1, 2} {3, 4} disks.
3. raid30
Like raid50, adding a layer of raid0 is to make the data more dispersed and improve read/write performance. Higher fault tolerance capability.
Iv. raid50