RAID相关知识简介

来源:互联网 发布:李易峰2017过气 知乎 编辑:程序博客网 时间:2024/04/29 17:25

RAID是什么

RAID (originally redundant array of inexpensive disks, now commonly redundant array of independent disks) is a data storage virtualization technology that combines multiple physical disk drive components into a single logical unit for the purposes of data redundancy, performance improvement, or both.

RAID翻译为中文名为,“独立磁盘冗余阵列”,之前老的叫法是,“廉价磁盘冗余阵列”。

RAID的作用

Data is distributed across the drives in one of several ways, referred to as RAID levels, depending on the required level of redundancy and performance. The different schemas, or data distribution layouts, are named by the word RAID followed by a number, for example RAID 0 or RAID 1. Each schema, or a RAID level, provides a different balance among the key goals: reliability, availability, performance, and capacity. RAID levels greater than RAID 0 provide protection against unrecoverable sector read errors, as well as against failures of whole physical drives.

  1. 提高传输速率
    RAID通过在多个磁盘上同时存储和读取数据来大幅提高存储系统的throughput。在RAID中,可以让很多磁盘驱动器同时传输数据,而这些磁盘驱动器在逻辑上又是一个磁盘驱动器,所以使用RAID可以达到单个磁盘驱动器几倍、几十倍甚至上百倍的速率。这也是RAID最初想要解决的问题。

  2. 提高数据安全性
    RAID由两个或以上磁盘组成,除了RAID 0外,其余的RAID模式都有数据冗余功能,当一个硬盘坏掉后,RAID组可以通过镜像,校验恢复等措施,保证不会造成数据丢失。

几种常见RAID

RAID 0 (FAST模式)

RAID 0 consists of striping, without mirroring or parity. The capacity of a RAID 0 volume is the sum of the capacities of the disks in the set, the same as with a spanned volume. There is no added redundancy for handling disk failures, just as with a spanned volume. Thus, failure of one disk causes the loss of the entire RAID 0 volume, with reduced possibilities of data recovery when compared to a broken spanned volume. Striping distributes the contents of files roughly equally among all disks in the set, which makes concurrent read or write operations on the multiple disks almost inevitable and results in performance improvements. The concurrent operations make the throughput of most read and write operations equal to the throughput of one disk multiplied by the number of disks. Increased throughput is the big benefit of RAID 0 versus spanned volume, at the cost of increased vulnerability to drive failures.

RAID 0将数据被分别存储在多块硬盘上。此时硬盘的理论存储速度是单块硬盘的2倍。
例如,如果你有N块磁盘,原来只能同时写一块磁盘,写满了再下一块。做了RAID 0之后,N块可以同时写,速度提升很快,但由于没有备份,可靠性很差。N最少为2。
* 数据传输速度最快
* 并没有提供数据可靠性
* 空间利用率100%

RAID 1(SAFE模式)

RAID 1 consists of data mirroring, without parity or striping. Data is written identically to two (or more) drives, thereby producing a “mirrored set” of drives. Thus, any read request can be serviced by any drive in the set. If a request is broadcast to every drive in the set, it can be serviced by the drive that accesses the data first (depending on its seek time and rotational latency), improving performance. Sustained read throughput, if the controller or software is optimized for it, approaches the sum of throughputs of every drive in the set, just as for RAID 0. Actual read throughput of most RAID 1 implementations is slower than the fastest drive. Write throughput is always slower because every drive must be updated, and the slowest drive limits the write performance. The array continues to operate as long as at least one drive is functioning.

RAID 1把用户写入磁盘的数据100%地自动复制到另外一个磁盘上,两块硬盘互为镜像,互为备份。
例如,正因为RAID 0太不可靠,所以衍生出了RAID 1。如果你有N块磁盘,把其中N/2块磁盘作为镜像磁盘,在往其中一块磁盘写入数据时,也同时往另一块写数据。坏了其中一块时,镜像磁盘自动顶上,可靠性最佳,但空间利用率太低。N最少为2。
* 并没有性能上的提升
* mirror功能,最大限度的保证用户数据的可用性和可修复性
* 空间利用率50%

RAID 5

RAID 5 consists of block-level striping with distributed parity. Unlike RAID 4, parity information is distributed among the drives, requiring all drives but one to be present to operate. Upon failure of a single drive, subsequent reads can be calculated from the distributed parity such that no data is lost. RAID 5 requires at least three disks. RAID 5 is seriously affected by the general trends regarding array rebuild time and the chance of drive failure during rebuild. Rebuilding an array requires reading all data from all disks, opening a chance for a second drive failure and the loss of the entire array. In August 2012, Dell posted an advisory against the use of RAID 5 in any configuration on Dell EqualLogic arrays and RAID 50 with “Class 2 7200 RPM drives of 1 TB and higher capacity” for business-critical data.

RAID 5不对存储的数据进行备份,而是把数据和与其对应的奇偶校验信息存储到各个磁盘上,并且奇偶校验信息和相对应的数据分别存储在不同的磁盘上。RAID 5是一种存储性能、数据安全和存储成本兼顾的存储解决方案,它使用的是Disk Striping(硬盘分区)技术。RAID 5至少需要三颗硬盘,当RAID 5的一个硬盘数据发生故障后,可以利用剩下的数据和相应的奇偶校验信息去恢复被损坏的数据。RAID 5可以理解为是RAID 0和RAID 1的折衷方案。
例如,在RAID 3的基础上有所区别,同样是相当于是1块盘的大小作为校验盘,N-1块盘的大小作为数据盘,但校验码分布在各个磁盘中,不是单独的一块磁盘,也就是分布式校验盘,这样做好处多多。最多坏一块盘。N最少为3。
* 提供了更高的数据流量,更适合于小数据块和随机读写的数据
* 有数据冗余,最多运行坏一块磁盘
* 空间利用率为N-1

RAID 10 (Nested/Hybrid RAID)

In what was originally termed hybrid RAID, many storage controllers allow RAID levels to be nested. The elements of a RAID may be either individual drives or arrays themselves. Arrays are rarely nested more than one level deep. The final array is known as the top array. When the top array is RAID 0 (such as in RAID 1+0 and RAID 5+0), most vendors omit the “+” (yielding RAID 10 and RAID 50, respectively).

RAID 10从主路分出两路,即把数据分割,而这分割出来的每一路再分割为两路。
* striping + mirroring/parity,同时拥有RAID 0的高数据传输率,和RAID 1的数据高可靠性

总结

pic1

pic2

参考

[1] RAID (redundant array of independent disks)
[2] RAID的种类

0 0
原创粉丝点击