Starting from server construction (2). Disk Array raid

Source: Internet
Author: User

Starting from server construction (2). Disk Array raid

Grass papaya sorting 20070403

I. Sequencing

Storage is the management core of modern enterprise servers. disk arrays, tape drives, and other storage devices are the top priorities.
An important task of server building is to manage storage media.

Ii. Raid Concept

RAID (Redundant Arrays of Independent Disks) is a cheap redundant disk array in Chinese.

In the early stages of computer development, the price for "large-capacity" hard disks was still quite high, solving the problem of data storage security
The main method is to use a tape drive and other devices for backup. This method can ensure data security,
Both query and backup are cumbersome. In 1987, Patterson, Gibson, and Katz engineers
The University of California, Berkeley, published the title "a case of Redundant Array of inexpensive
In this paper, the basic idea of disks is
The combination of cheap hard drive makes it more efficient than an expensive large hard drive. This design idea is very
The raid technology has been widely used, and data storage has become faster, safer, and cheaper.
.
To put it simply, raid is a combination of multiple hard disks to provide efficient and redundant functions.

Iii. Raid advantages

High transmission rate. In raid, many disk drives can transmit data at the same time.
The device is a disk drive logically, so raid can be used several times or dozens of times as many as a single disk drive.
Times or even hundreds of times. This is also the problem raid originally wanted to solve. Because at that time, the CPU speed was growing fast,
However, the data transmission rate of the disk drive cannot be significantly improved, so there is a solution to solve the conflict between the two.
Raid is successful.

Fault Tolerance is supported. This is the second advantage of RAID, because a general disk drive cannot provide
Fault Tolerance function, if not including the CRC (Cyclic Redundancy verification) code written on the disk. RAID fault tolerance is based on
Hardware fault tolerance of disks, So it provides higher security.

In addition, raid is much cheaper than traditional large-diameter disk drives with the same capacity.

Iv. Raid Classification

(1): RAID 0 (strip striping)

RAID 0 requires at least two Hard Disks without any data protection. It only requires two or more identical disks.
Number and capacity of the hard disk combination, and when the system extracts data, it can be at the same time by all the hard disks (the same Array
) Read data, the speed will be much faster than a hard disk. The total disk array capacity is the sum of the disk capacity. It
Use a technology called "Strip" (stripe) to distribute data to each disk. Where each "band"
The data is distributed to consecutive blocks, which are divided into several blocks from 512 bytes to several megabytes, and then alternate.
Write to disk. 1st are written to disk 1, 2nd are written to Disk 2, and so on. When the system reaches the Array
When the last disk in, it is written to the next segment of Disk 1.
Split data can evenly distribute I/O loads to all drives. Because the drive can be written or read at the same time,
This significantly improves the performance. However, it does not have data protection capabilities. If a disk fails, the data
It will be completely lost. Therefore, RAID 0 is not applicable to critical task environments, but its strength lies in videos and images.
And other applications that frequently read and write disks, as well as temporary conversion storage.
RAID 0 is the highest disk capacity utilization.

(2): Raid 1 (Mirror)

Raid 1 is also called a mirror because data on one disk is completely copied to another disk. If
Disk data errors, or bad sectors on the hard disk, the other hard disk can remedy the disk failure.
Data loss and system interruption. In addition, RAID 1 can also achieve Duplex-that is, the entire controller can be copied,
In this way, when a disk or controller failure occurs, all data can be protected. The disadvantage of mirroring and duplex is that
You need to multiply the number of drives to copy data. During data reading, the system can simultaneously
Read, this will improve the Read efficiency, but when writing data, the system needs to execute another write operation, this will
The write efficiency is affected. Raid 1 is a safe method. It can be implemented through software or hardware.

(3) RAID 0 + 1 (Image array strip, also known as raid 10, striping + mirror)

RAID 0 + 1 provides 100% data redundancy and supports larger volumes. Creating RAID 0 + 1 requires at least 4
Disk, two of which are strip data distribution, that is, creating a RAID 0 to improve read/write performance, while the other two
The block is the first two images, ensuring the complete backup of data. In fact, we should first create two RAID 0 s to form two
And then mirror the two RAID 0 disks. Although its hard disk usage is 50%, it is the most efficient
Rate planning method.

(4): Raid 1 + 0 (mirror + striping)

First, the disk is divided into two groups for RAID 1, and then the image disk is RAID 0. From hard disk usage efficiency and
For data read/write efficiency, RAID 1 + 0 is exactly the same as RAID 0 + 1. But in terms of reliability,
Raid 1 + 0 is safer than RAID 0 + 1.
A simple example:
RAID 0 + 1 Mode: A1 + A2/B1 + b2
If the A1 disk breaks down at this time, it is equivalent to A1 + A2. If any of the B1 + B2 quick disks breaks down, this
Raid cannot work. That is to say, in the case of bad two fast disks, there is only a 2/6 probability that the disks can run normally. (Number
There are six methods to obtain two pieces in the four quick combinations, and only two methods can run normally)

Raid 1 + 0 mode: A1/A2 + B1/b2
At this time, the probability of normal operation of two bad disks is 1-2/6 = 4/6, that is, only two methods will lead to abnormal
Run.

(5): Raid 2, RAID 3, raid 4, and RAID 5

These raid methods use the concept of verification to provide Fault Tolerance capabilities. Simply put, we can think of verification
Such as a binary checksum, which can tell whether all other characters are correct.
Common verification, such as parity verification and CRC verification. In the field of data communication, parity is often used to determine the number
Whether the data is transmitted correctly. For example, for each byte, we can simply calculate the number of digits 1, and
Add an additional check bit to the byte. Assume that the stored data is marked as 1, 1, 1, 0, 0, 1, 0, and 1 with bits.
Add each bit (1 + 1 + 1 + 0 + 0 + 1 + 0 + 1 = 5) and the result is an odd number. In this case, the check bit is defined as 1,
The opposite is 0. When reading the sent data, the data stored in the first eight bits is added again, and whether the calculation result is consistent
Check bit is consistent. Thus, communication errors can be detected to a certain extent. The parity check can only detect errors but cannot
It is corrected. Although the probability of two-bit simultaneous errors is quite low, the parity check cannot detect the two-bit
Error.
This is far from enough for raid. Although error detection is very important, if the error cannot be detected
To improve the reliability of the entire system.

RAID 3 parallel transfer with parity (parallel transmission and verification)

RAID 3 uses a simple verification implementation method, using a dedicated disk to store all the schools
Verify the data, and create a read/write operation for the scattered data with a zone set (that is, striping) in the remaining disk. For example
In a raid 3 system consisting of four hard disks, three hard disks are used to save data, and the fourth hard disk is used for school
Verification. Each verification block in the fourth hard disk contains the verification information of the corresponding data block in the other three hard disks.
The success of RAID 3 is that it not only provides Fault Tolerance functions like RAID 1, but also overhead from RAID 1
50% is reduced to 25% (RAID 3 + 1 ). As the number of disks used increases, the cost and cost will decrease.
In different situations, RAID 3 read/write operations are complex. The simplest case is from a good
Read data from RAID 3. In this case, you only need to find the corresponding data block in the data storage disk for read operations.
No additional system overhead.
When writing data to raid 3, the situation becomes more complex. Even if we write only one
The data block must also calculate the check value of all data blocks in the same zone as the data block and re-write the new value.
To the verification block.

Disk 1 Disk 2 Disk 3 check Disk

Band A Zone A check block
Zone B zone B check block B
...

We can simplify the RAID system by setting the size of the band. If the length of a write operation
Exactly equal to the size of a complete band (written in the full band), so we do not have to read the number of associations in the band.
Calculate the data block verification value. We only need to calculate the verification value of the entire band, and then write the data and verification information directly.
Data disk and verification disk.

Although RAID 3 is fault tolerant, the system is affected. When a disk fails
All data blocks must be re-created using verification information. If we read data blocks from a good disk, there will be no
Change. However, if the data block we want to read is located on a damaged disk, you must read the same
All other data blocks in the band, and reconstruct the lost data based on the check value.
After we replace the damaged disk, the system must create a data block and a data block to reconstruct the number of bad disks.
Data. The entire process includes reading the band, calculating the lost data blocks, and writing new data blocks to the new disk.
Automatically. Reconstruction is best performed when the RAID system is idle. Otherwise, the performance of the entire system will be strict.
.
The biggest disadvantage of RAID 3 is that raid 3 is rarely used.
The verification disk can easily become the bottleneck of the entire system.
We already know that raid 3 will distribute data writes to multiple disks.
When writing data to a data disk, you must overwrite the relevant information in the disk. Therefore
For applications that execute a large number of write operations, the load on the verification disk will be very large and cannot meet the running speed of the program.
As a result, the performance of the entire raid system is reduced. For this reason, RAID 3 is more suitable for those write operations.
Application environments with fewer read operations.

In terms of concept, raid 2 is similar to raid 3, both of which block data on different hard disks,
The Unit is bit or byte. However, raid 2 is called "Hamming Code ECC (hamming code error detection and
Correction) "encoding technology to provide error detection and recovery.
This encoding technology requires multiple disks to store inspection and recovery information, making raid 2 more complicated.
Raid 2 is a technology developed in the early days to enable real-time data verification (such as RAID 0 and 1 at the time ).
Level is not possible), from its design, it is also mainly for real-time verification to ensure data security,
At that time, it was very sensitive to real-time data security, such as servers and financial services. However, the cost is too high.
It is expensive and is basically no longer used. Instead, it is replaced by more advanced instant inspection raid, such as RAID 3 and 5.
(Hamming code is a coding technology that inserts a number of verification codes in the original data for error check and correction. Yes
If you are interested, you can read the relevant documents)

RAID 3 is developed on the basis of raid 2, and the main change is to use relatively simple XOR or logical operations.
(XOR, exclusive or) Verification replaces the relatively complex Chinese code verification, which greatly reduces the cost.

Raid 4 independent data disks with shared parity disk (independent data hard disk and shared verification hard disk)

Like raid 2 and RAID 3, raid 4 also blocks and distributes data on different disks, but blocks
The Unit is block. Raid 4 is stored on a data block basis. How can this problem be solved? In simple cases,
A data block is a complete data set. For example, a file is a typical data block. Raid 4
Block-based storage ensures block integrity and is not adversely affected by the storage of strips on other hard disks.
(For example, when multiple other hard disks are damaged, the data is complete ).

(5): RAID 5

The performance of RAID 3's disk verification has caused almost all RAID systems to switch to RAID 5. Running
In terms of mechanism, RAID 5 and RAID 3 are identical, and they are also shared by several data blocks in the same zone.
The biggest difference between RAID 5 and RAID 3 is that RAID 5 does not store all verification blocks in a dedicated
The verification disk is distributed to all data disks. RAID 5 uses a special algorithm that can be computed
The storage location of a band verification block. As follows:

Disk 1 Disk 2 Disk 3 disk 4

Verification block a zone A Zone
Band B verification Block B zone B
Band C zone C check block C zone C
...

The verification block has been stored in different disks, so that any read/write operations on the verification block can be ensured.
Operations are balanced across all RAID disks, eliminating the possibility of bottlenecks.
The control of RAID 5 is complicated, especially the control of the disk array by hardware, because the application of this method is
More things are required than other RAID levels, and more output/input requirements are required.
Data Processing, calculation of verification values, error correction, etc., so the price is high.

(6): Raid 6

Compared with RAID 5, raid 6 adds the second independent parity information block. Two Independent parity systems
Different algorithms are used to ensure high data reliability. Even if the two disks are invalid at the same time, data usage will not be affected.
However, you need to allocate more disk space to the parity check information, which has a greater "Write loss" compared with RAID 5 ". Raid 6
The write performance is very poor. Poor performance and complex implementation make raid 6 seldom used.

(7): Raid 7

Raid 7 comes with an intelligent real-time operating system and a software tool for storage management.
Host running, not occupying host CPU resources. Raid 7
System) is a real-time event-driven operating system, mainly used for system initialization and arrangement of RAID 7 disk arrays.
All data of columns are transmitted and converted to the corresponding physical storage drive. Use storage computer
Operating system to set and control the read/write speed, so that the host I/O transmission performance can be optimal. If
If a disk fails, the system can automatically restore the disk and manage the reconstruction process of the backup disk.
Raid 7 adopts non-synchronous access, which greatly reduces the Data Writing bottleneck and increases the I/O speed.
(Non-synchronous access, that is, each I/O interface of RAID 7 has a dedicated high-speed channel for data or control.
Information flow path, so you can independently control the data access to each disk in your system .) If raid 7 has n
Disk, so apart from a verification disk (for redundancy calculation), can simultaneously process N-1 host systems randomly issued
Read/write commands significantly improve I/O applications. Raid 7 built-in real-time operating system can also automatically send to the host
The read/write commands sent are optimized to intelligently read data into the cache in advance,
This greatly reduces the rotation times of the head and increases the I/O speed. Raid 7 can help users effectively manage growing volumes
To meet the different needs of various users.
Raid 7 is the raid mode with the highest performance theoretically.

5. Write at the end

As an introduction to raid, this article only sorts out various RAID articles. Here we recommend several more articles.
For system or professional articles:
Shi chengge's introduction to Network Storage
Zhao Xiaomin: Let's talk about raid

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.