个人工具

“Quick HOWTO : Ch26 : Linux Software RAID/zh”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
RAID 5
图26.2 RAID 5的工作方式
第74行: 第74行:
  
 
[[Image:raid5.gif]]
 
[[Image:raid5.gif]]
 +
 +
= 前言 =
 +
 +
Specially built hardware-based RAID disk controllers are available for both IDE and SCSI drives. They usually have their own BIOS, so you can configure them right after your system's the power on self test (POST). Hardware-based RAID is transparent to your operating system; the hardware does all the work.
 +
 +
If hardware RAID isn't available, then you should be aware of these basic guidelines to follow when setting up software RAID.
 +
 +
== IDE驱动器 ==
 +
 +
To save costs, many small business systems will probably use IDE disks, but they do have some limitations.
 +
 +
*The total length of an IDE cable can be only a few feet long, which generally limits IDE drives to small home systems.
 +
*IDE drives do not hot swap. You cannot replace them while your system is running.
 +
*Only two devices can be attached per controller.
 +
*The performance of the IDE bus can be degraded by the presence of a second device on the cable.
 +
*The failure of one drive on an IDE bus often causes the malfunctioning of the second device. This can be fatal if you have two IDE drives of the same RAID set attached to the same cable.
 +
 +
For these reasons, I recommend you use only one IDE drive per controller when using RAID, especially in a corporate environment. In a home or SOHO setting, IDE-based software RAID may be adequate.
 +
 +
==SATA 驱动器==
 +
 +
Serial ATA type drives are rapidly replacing IDE, or Ultra ATA, drives as the preferred entry level disk storage option because of a number of advantages:
 +
 +
*The drive data cable can be as long as 1 meter in length versus IDE's 18 inches.
 +
*Serial ATA has better error checking than IDE.
 +
*There is only one drive per cable which makes hot swapping, or the capability to replace components while the system is still running, possible without the fear of affecting other devices on the data cable.
 +
*There are no jumpers to set on Serial ATA drives to make it a master or slave which makes them simpler to configure.
 +
*IDE drives have a 133Mbytes/s data rate whereas the Serial ATA specification starts at 150 Mbytes/sec with a goal of reaching 600 Mbytes/s over the expected ten year life of the specification.
 +
 +
If you can't afford more expensive and faster SCSI drives, Serial ATA would be the preferred device for software and hardware RAID
 +
 +
==SCSI驱动器==
 +
 +
SCSI hard disks have a number of features that make them more attractive for RAID use than either IDE or Serial ATA drives.
 +
 +
*SCSI controllers are more tolerant of disk failures. The failure of a single drive is less likely to disrupt the remaining drives on the bus.
 +
*SCSI cables can be up to 25 meters long, making them suitable for data center applications.
 +
*Much more than two devices may be connected to a SCSI cable bus. It can accommodate 7 (single-ended SCSI) or 15 (all other SCSI types) devices.
 +
*Some models of SCSI devices support "hot swapping" which allows you to replace them while the system is running.
 +
*SCSI currently supports data rates of up to 640 Mbytes/s making them highly desirable for installations where rapid data access is imperative.
 +
 +
SCSI drives tend to be more expensive than IDE drives, however, which may make them less attractive for home use.
 +
 +
==我应该用软件式RAID分区还是整个磁盘?==
 +
 +
It is generally a not a good idea to share RAID-configured partitions with non-RAID partitions. The reason for this is obvious: A disk failure could still incapacitate a system.
 +
 +
If you decide to use RAID, all the partitions on each RAID disk should be part of a RAID set. Many people simplify this problem by filling each disk of a RAID set with only one partition.
 +
 +
==第一是备份你的系统==
 +
 +
Software RAID creates the equivalent of a single RAID virtual disk drive made up of all the underlying regular partitions used to create it. You have to format this new RAID device before your Linux system can store files on it. Formatting, however, causes all the old data on the underlying RAID partitions to be lost. It is best to backup the data on these and any other partitions on the disk drive on which you want implement RAID. A mistake could unintentionally corrupt valid data.
 +
 +
==将RAID配置为单用户模式==
 +
 +
As you will be modifying the disk structure of your system, you should also consider configuring RAID while your system is running in single-user mode from the VGA console. This makes sure that most applications and networking are shutdown and that no other users can access the system, reducing the risk of data corruption during the exercise.
 +
 +
[root@bigboy tmp]# init 1
 +
 +
Once finished, issue the exit command, and your system will boot in the default runlevel provided in the /etc/inittab file.

2008年6月3日 (二) 19:09的版本


简介

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

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

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

RAID 类型

不管是硬件式或软件式,冗余磁盘阵列RAID能用很多不同的标准来配置,下面我们看看最流行的几种配置方式

线性RAID

在线性RAID中,RAID控制器将RAID集(set)视为一个磁盘链。当前一个磁盘空间被填满后,数据顺序写入磁盘链中的下一个磁盘。 线性RAID的目的是容纳跨磁盘的超大文件系统,而且没有数据冗余性。驱动器故障将损坏您的数据。

Fedora Linux不支持此方式的RAID。

RAID 0

在RAID 0下,RAID控制器试图将数据平均的写入RAID集(set)中的所有磁盘。

将磁盘视为盘子,将数据视为蛋糕。假设你有四个蛋糕-巧克力味、香草味、樱桃味、草莓味-和四个盘子。RAID 0初始操作是将蛋糕切成片,然后将这些片放到每个盘子里。RAID 0 驱动器让操作系统觉得蛋糕是完整的,而且是放到了一个大盘子里。例如,4个9GB的硬盘,配置成RAID 0集的话,操作系统将它们视为一个36GB的硬盘

和线性RAID相似,RAID 0也是为了容纳跨磁盘的超大容量文件系统,并没有数据冗余性。RAID 0的优点是数据访问速度。一个文件分放在四个磁盘上能以四倍于一个磁盘的读取速度读取出来。记住RAID 0常被称为条带集

RAID 0允许磁盘的空间大小不同。当RAID使用完最小磁盘上的条带空间时,它继续使用剩余磁盘的可用空间作为条带集。当这种情况发生时,这部分数据的访问速度将变慢,因为RAID驱动器的数量减少了。所以,RAID 0 最好使用同容量的磁盘。

Fedora Linux支持RAID 0 ,图26.1说明了RAID 0的数据分配过程

RAID 1

在RAID 1方式下,数据被复制放到另一磁盘上。这种RAID方式因此经常被称之为磁盘镜像。想像一下,您将一个同样的故事说给两个人挺,这样的话,如果其中一个人忘记了故事的情节,您可以让另一个来告诉您。

当RAID 1集中的一个磁盘坏了的话,剩下的那个磁盘仍然能够工作。当坏的磁盘被更换后,数据能够自动的从剩下的那个好的磁盘上复制到新磁盘上。在任一主RAID磁盘发生故障时,RAID 1还可以将数据自动的复制到一个热备的空磁盘上。

RAID 1提供了数据冗余性,但没有RAID 0的速度优点。软件式的RAID 1的一个缺点是服务器不得不将数据写入两次以便写入每个镜像磁盘。这回占用数据总线和cpu资源。在硬件式RAID 1下,服务器cpu只需将数据传给RAID磁盘控制器一次,剩下的工作就由磁盘控制器来完成了。这使得在实现RAID 1时,优先选用能提供RAID的磁盘控制器

RAID 1 的一个限制是总的RAID集大小等于磁盘集中容量最小的那块磁盘。这跟RAID 0不同,较大磁盘中剩余部分的磁盘空间会浪费掉。

Fedora Linux支持RAID 1。 图26.1说明了RAID 1方式下的数据分发过程

图26.1 RAID 0和RAID 1 的工作方式

Raid0.gif

RAID 4

RAID 4和RAID 0工作方式一样,但增加了错误纠正或奇偶校验。为达到这个目的,需要再增加一块磁盘

RAID 4需要最少3块磁盘才能组成RAID集,而且它能在其中一个磁盘坏掉的情况下恢复数据。当其中一个磁盘坏掉时,在奇偶校验磁盘的帮助下,数据能够被重建。当坏掉的磁盘被更换后,在奇偶校验磁盘的帮助下丢失的数据在新磁盘中重建

RAID 4既有RAID 0的高访问速度也有RAID 1的数据冗余性。他的最大缺点是数据被条带化(striped)了,但奇偶校验信息没有。换句话说,任何数据在写入RAID集中数据的任何位置时,必须更新奇偶校验磁盘中的数据。奇偶校验磁盘因此成为了瓶颈。因此,RAID 4并不常用。

Fedora Linux不支持RAID 4

RAID 5

RAID 5 改进了RAID 4的工作方式,它将奇偶校验数据条带到RAID集中的所有磁盘上。这就避免了奇偶校验磁盘的瓶颈效应,而保留了RAID 0的高速和RAID 1 的数据冗余性。和RAID 4 一样,RAID 5只能在其中一块磁盘故障时恢复数据。

Fedora Linux支持RAID 5。图26.2说明了RAID 5的数据分放方式

Linux RAID 5需要最少三个磁盘或分区。

图26.2 RAID 5的工作方式

Raid5.gif

前言

Specially built hardware-based RAID disk controllers are available for both IDE and SCSI drives. They usually have their own BIOS, so you can configure them right after your system's the power on self test (POST). Hardware-based RAID is transparent to your operating system; the hardware does all the work.

If hardware RAID isn't available, then you should be aware of these basic guidelines to follow when setting up software RAID.

IDE驱动器

To save costs, many small business systems will probably use IDE disks, but they do have some limitations.

  • The total length of an IDE cable can be only a few feet long, which generally limits IDE drives to small home systems.
  • IDE drives do not hot swap. You cannot replace them while your system is running.
  • Only two devices can be attached per controller.
  • The performance of the IDE bus can be degraded by the presence of a second device on the cable.
  • The failure of one drive on an IDE bus often causes the malfunctioning of the second device. This can be fatal if you have two IDE drives of the same RAID set attached to the same cable.

For these reasons, I recommend you use only one IDE drive per controller when using RAID, especially in a corporate environment. In a home or SOHO setting, IDE-based software RAID may be adequate.

SATA 驱动器

Serial ATA type drives are rapidly replacing IDE, or Ultra ATA, drives as the preferred entry level disk storage option because of a number of advantages:

  • The drive data cable can be as long as 1 meter in length versus IDE's 18 inches.
  • Serial ATA has better error checking than IDE.
  • There is only one drive per cable which makes hot swapping, or the capability to replace components while the system is still running, possible without the fear of affecting other devices on the data cable.
  • There are no jumpers to set on Serial ATA drives to make it a master or slave which makes them simpler to configure.
  • IDE drives have a 133Mbytes/s data rate whereas the Serial ATA specification starts at 150 Mbytes/sec with a goal of reaching 600 Mbytes/s over the expected ten year life of the specification.

If you can't afford more expensive and faster SCSI drives, Serial ATA would be the preferred device for software and hardware RAID

SCSI驱动器

SCSI hard disks have a number of features that make them more attractive for RAID use than either IDE or Serial ATA drives.

  • SCSI controllers are more tolerant of disk failures. The failure of a single drive is less likely to disrupt the remaining drives on the bus.
  • SCSI cables can be up to 25 meters long, making them suitable for data center applications.
  • Much more than two devices may be connected to a SCSI cable bus. It can accommodate 7 (single-ended SCSI) or 15 (all other SCSI types) devices.
  • Some models of SCSI devices support "hot swapping" which allows you to replace them while the system is running.
  • SCSI currently supports data rates of up to 640 Mbytes/s making them highly desirable for installations where rapid data access is imperative.

SCSI drives tend to be more expensive than IDE drives, however, which may make them less attractive for home use.

我应该用软件式RAID分区还是整个磁盘?

It is generally a not a good idea to share RAID-configured partitions with non-RAID partitions. The reason for this is obvious: A disk failure could still incapacitate a system.

If you decide to use RAID, all the partitions on each RAID disk should be part of a RAID set. Many people simplify this problem by filling each disk of a RAID set with only one partition.

第一是备份你的系统

Software RAID creates the equivalent of a single RAID virtual disk drive made up of all the underlying regular partitions used to create it. You have to format this new RAID device before your Linux system can store files on it. Formatting, however, causes all the old data on the underlying RAID partitions to be lost. It is best to backup the data on these and any other partitions on the disk drive on which you want implement RAID. A mistake could unintentionally corrupt valid data.

将RAID配置为单用户模式

As you will be modifying the disk structure of your system, you should also consider configuring RAID while your system is running in single-user mode from the VGA console. This makes sure that most applications and networking are shutdown and that no other users can access the system, reducing the risk of data corruption during the exercise.

[root@bigboy tmp]# init 1

Once finished, issue the exit command, and your system will boot in the default runlevel provided in the /etc/inittab file.