Quick HOWTO : Ch26 : Linux Software RAID/zh

来自Ubuntu中文
Lipeng8413留言 | 贡献2008年6月3日 (二) 13:14的版本 →‎简介
跳到导航跳到搜索

{{#ifexist: :Quick HOWTO : Ch26 : Linux Software RAID/zh/zh | | {{#ifexist: Quick HOWTO : Ch26 : Linux Software RAID/zh/zh | | {{#ifeq: {{#titleparts:Quick HOWTO : Ch26 : Linux Software RAID/zh|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Quick HOWTO : Ch26 : Linux Software RAID/zh|1|-1|}} | zh | | }}


简介

使用独立磁盘冗余阵列(RAID)的主要目的是提高磁盘数据处理能力和提供数据冗余。

RAID既能通过操作系统来设置(软件式RAID),也可以在不设置操作系统的情况下通过硬件RAID控制器来实现(硬件式RAID)。这章将向您解释如何在Redhat/Fedora linux下配置软件式RAID结构。

为简洁起见,本章的重点是:在没有/boot或/文件系统的分区上进行RAID设置。

RAID 类型

Whether hardware- or software-based, RAID can be configured using a variety of standards. Take a look at the most popular.

Linear Mode RAID

In the Linear RAID, the RAID controller views the RAID set as a chain of disks. Data is written to the next device in the chain only after the previous one is filled.

The aim of Linear RAID is to accommodate large filesystems spread over multiple devices with no data redundancy. A drive failure will corrupt your data.

Linear mode RAID is not supported by Fedora Linux.

RAID 0

With RAID 0, the RAID controller tries to evenly distribute data across all disks in the RAID set.

Envision a disk as if it were a plate, and think of the data as a cake. You have four cakes- chocolate, vanilla, cherry and strawberry-and four plates. The initialization process of RAID 0, divides the cakes and distributes the slices across all the plates. The RAID 0 drivers make the operating system feel that the cakes are intact and placed on one large plate. For example, four 9GB hard disks configured in a RAID 0 set are seen by the operating system to be one 36GB disk.

Like Linear RAID, RAID 0 aims to accommodate large filesystems spread over multiple devices with no data redundancy. The advantage of RAID 0 is data access speed. A file that is spread over four disks can be read four times as fast. You should also be aware that RAID 0 is often called striping.

RAID 0 can accommodate disks of unequal sizes. When RAID runs out of striping space on the smallest device, it then continues the striping using the available space on the remaining drives. When this occurs, the data access speed is lower for this portion of data, because the total number of RAID drives available is reduced. For this reason, RAID 0 is best used with drives of equal size.

RAID 0 is supported by Fedora Linux. Figure 26.1 illustrates the data allocation process in RAID 0.

RAID 1

With RAID 1, data is cloned on a duplicate disk. This RAID method is therefore frequently called disk mirroring. Think of telling two people the same story so that if one forgets some of the details you can ask the other one to remind you.

When one of the disks in the RAID set fails, the other one continues to function. When the failed disk is replaced, the data is automatically cloned to the new disk from the surviving disk. RAID 1 also offers the possibility of using a hot standby spare disk that will be automatically cloned in the event of a disk failure on any of the primary RAID devices.

RAID 1 offers data redundancy, without the speed advantages of RAID 0. A disadvantage of software-based RAID 1 is that the server has to send data twice to be written to each of the mirror disks. This can saturate data busses and CPU use. With a hardware-based solution, the server CPU sends the data to the RAID disk controller once, and the disk controller then duplicates the data to the mirror disks. This makes RAID-capable disk controllers the preferred solution when implementing RAID 1.

A limitation of RAID 1 is that the total RAID size in gigabytes is equal to that of the smallest disk in the RAID set. Unlike RAID 0, the extra space on the larger device isn't used.

RAID 1 is supported by Fedora Linux. Figure 26.1 illustrates the data allocation process in RAID 1.

Figure 26-1 RAID 0 And RAID 1 Operation


RAID 4

RAID 4 operates likes RAID 0 but inserts a special error-correcting or parity chunk on an additional disk dedicated to this purpose.

RAID 4 requires at least three disks in the RAID set and can survive the loss of a single drive only. When this occurs, the data in it can be recreated on the fly with the aid of the information on the RAID set's parity disk. When the failed disk is replaced, it is repopulated with the lost data with the help of the parity disk's information.

RAID 4 combines the high speed provided of RAID 0 with the redundancy of RAID 1. Its major disadvantage is that the data is striped, but the parity information is not. In other words, any data written to any section of the data portion of the RAID set must be followed by an update of the parity disk. The parity disk can therefore act as a bottleneck. For this reason, RAID 4 isn't used very frequently.

RAID 4 is not supported by Fedora Linux.

RAID 5

RAID 5 improves on RAID 4 by striping the parity data between all the disks in the RAID set. This avoids the parity disk bottleneck, while maintaining many of the speed features of RAID 0 and the redundancy of RAID 1. Like RAID 4, RAID 5 can survive the loss of a single disk only.

RAID 5 is supported by Fedora Linux. Figure 26.2 illustrates the data allocation process in RAID 5.

Linux RAID 5 requires a minimum of three disks or partitions.

Figure 26-2 RAID 5 Operation