Dell Software RAID クイックスタートガイド

www.dell.com | support.dell.com
Dell™ Operating System RAID
Software RAID with Red Hat
®
Enterprise Linux 4
Red Hat
®
Enterprise Linux 4 提供的软件 RAID
RAID logiciel avec Red Hat
®
Enterprise Linux 4
Software-RAID mit Red Hat
®
Enterprise Linux 4
Red Hat
®
Enterprise Linux 4
によるソフトウェア RAID
소프트웨어 RAID Red Hat
®
Enterprise Linux 4
RAID por software
con Red Hat
®
Enterprise Linux 4
www.dell.com | support.dell.com
Dell™ Operating System RAID
Software RAID with Red Hat
®
Enterprise Linux 4
Notes and Notices
NOTE: A NOTE indicates important information that helps you make better use of your computer.
NOTICE: A NOTICE indicates either potential damage to hardware or loss of data and tells you how to avoid the problem.
____________________
Information in this document is subject to change without notice.
© 2005 Dell Inc. All rights reserved.
Reproduction in any manner whatsoever without the written permission of Dell Inc. is strictly forbidden.
Trademarks used in this text: Dell and the DELL logo are trademarks of Dell Inc.; Red Hat is a registered trademark of Red Hat Corporation.
Other trademarks and trade names may be used in this document to refer to either the entities claiming the marks and names or their products.
Dell Inc. disclaims any proprietary interest in trademarks and trade names other than its own.
April 2005 P/N CC202 Rev. A00
Software RAID with Red Hat Enterprise Linux 4 3
Configuring and Managing Software RAID
with Red Hat
®
Enterprise Linux 4
The increasing cost-effectiveness of software RAID offers Linux system administrators an
alternative to more expensive hardware-based RAID implementations. This is due to the
performance and cost advantages of the Linux operating system and rapid advancements in
processor power. Using the software RAID layer and management tools in Red Hat Enterprise
Linux 4, you can build effective, cost-efficient software RAID implementations that best suit
your requirements.
Creating Software RAID Arrays During Linux Operating
System Installation
Complete the steps mentioned in the following sections to create each software RAID device.
Creating a software RAID boot partition
Creating a software RAID swap partition
Creating a software RAID root partition
Creating additional software RAID partitions
Before you can create a software RAID, you must partition your hard drive. Partitioning allows you
to divide your hard drive into isolated sections, where each section behaves as its own hard drive.
During the operating system installation, you are prompted to partition the hard drives from the
Disk Partitioning Setup
screen. The
Disk Partitioning Setup
screen provides two selections:
Automatically partition
Manually partition with Disk Druid
NOTICE: If you partition a drive that has existing data, the data will be lost.
If you do not want to partition your system yourself, choose
Automatically partition
and let the
installation program partition for you. To partition the drives manually, select
Manually partition
with Disk Druid
and click
Next.
Delete any existing devices and partitions by selecting them and
clicking
Delete.
You must delete the devices before deleting partitions.
Creating a Software RAID Boot Partition
1
To create a software RAID partition, click
RAID
and select
Create a software RAID partition
.
Click
OK
.
2
For the file system type, select
Software RAID
. Ensure that only one drive is selected for the
partition (for example,
sda
), the size is 100 MB, and select the
Fixed Size
box. Click
OK
to continue.
3
Repeat steps 1 and 2 to create a RAID partition on the second hard drive (for example,
sdb
)
.
4 Software RAID with Red Hat Enterprise Linux 4
www.dell.com | support.dell.com
4
Click
RAID
again, select
Create a RAID device
, and click
OK
.
5
Choose
/boot
for the type of mount point,
ext3
as the file system type,
md0
as the RAID
device, and
RAID 1
as the RAID level. Click
OK
.
Creating a Software RAID Swap Partition
1
To create a software RAID partition, click
RAID
and select
Create a software RAID partition
.
Click
OK
.
2
For the file system type, select
Software RAID.
Ensure that only one drive is selected for the
partition (for example,
sda
), the size is twice the amount of your system RAM memory, and
select the
Fixed Size
box. Click
OK
to continue.
3
Repeat steps 1 and 2 to create a RAID partition on the second hard drive (for example,
sdb
)
.
4
Click
RAID
again, select
Create a RAID device,
and click
OK.
5
Choose
swap
for the file system type,
md1
as the RAID device, and
RAID 1
as the RAID level.
Click
OK
.
Creating a Software RAID Root Partition
1
To create a software RAID partition, click
RAID
and select
Create a software RAID partition
.
Click
OK.
2
For the file system type, select
Software RAID.
Ensure that only one drive is selected for the
partition (for example,
sda
), enter the size you want for your root partition, and select the
Fixed Size
box. Click
OK
to continue.
3
Repeat steps 1 and 2 to create a RAID partition on the second hard drive (for example,
sdb.
)
4
Click
RAID
again, select
Create a RAID device,
and click
OK.
5
Choose "
/"
as the type of mount point,
ext3
as the file system type,
md2
as the RAID device,
and
RAID 1
as the RAID level. Click
OK.
Creating Additional Software RAID Partitions
1
To create a software RAID partition, click
RAID
and select
Create a software RAID partition
.
Click
OK.
2
For the file system type, select
Software RAID.
Ensure that only one drive is selected for the
partition (for example,
sda
), enter the size you want for your partition, and select the
Fixed
Size
box. Click
OK
to continue.
3
Repeat steps 1 and 2 to create a RAID partition on the second hard drive (for example,
sdb
)
.
4
Click
RAID
again, select
Create a RAID device,
and click
OK.
5
Choose the type of mount point, the file system type, the RAID device, and
RAID 1
as the
RAID level. Click
OK.
After you have created all the partitions, click
Next.
Software RAID with Red Hat Enterprise Linux 4 5
Preparing the System for Drive Failure
This section provides information on preparing the system for restoring RAID configuration to a
failed drive. Once the RAID devices are configured and the operating system has been
installed you can:
Create a backup copy of the partition table
Install GRUB (GRand Unified Bootloader) on the Master Boot Record (MBR)
of each drive
Copying the Partition Table
To copy a partition table, create a directory to store the partition information, and use the
sfdisk
command to write partition information files for each disk into that directory.
mkdir /raidinfo
sfdisk -d /dev/sda > /raidinfo/partitions.sda
sfdisk -d /dev/sdb > /raidinfo/partitions.sdb
The partition tables for both drives are stored on the mirrored partition so that in the event of a
drive failure, the other drive contains the pertinent partition information from which to rebuild
the partition.
Installing GRUB on the MBR
During the RAID configuration and operating system installation process, GRUB is installed on the
MBR of the primary hard drive (
sda
) only. However, if the primary disk drive fails, the system can
be booted by using a boot disk only. To avoid this problem, install GRUB on the MBR of each drive.
To install GRUB on the MBR of the secondary drive, temporarily define the secondary drive as the
primary disk. To do so, identify
sdb
as
hd0,
and instruct GRUB to write the MBR to the
secondary drive.
To enter the GRUB shell, type
grub
at the command prompt.
At the prompt
grub>:
device (hd0) /dev/sdb
root (hd0,0)
setup (hd0)
GRUB displays all the commands that run in the background of the setup command, and then
returns a message that the setup command succeeded. Both drives now have an MBR, and the
system can boot off either drive.
6 Software RAID with Red Hat Enterprise Linux 4
www.dell.com | support.dell.com
Restoring the RAID Configuration After a Drive Failure
When a hard drive in a software RAID 1 array fails, you can restore the RAID array onto a new drive
by following a three-step process:
Replacing the failed drive
Partitioning the replacement drive
Adding RAID partitions back into the md devices
If you suspect a drive failure, you can check the status of each RAID device by using the
following command:
cat /proc/mdstat
For example, a system missing a partition from the md0 device would show the following:
md0 : active raid1 sda1[0]
104320 blocks [2/1] [U_]
This output indicates that
md0
is active as a RAID 1 device and that partition
sda1
is currently
active in that RAID device. The output [
2/1
] denotes that two partitions should be available to
the device (the first value), but only one is currently available (the second value). The output [
U_
]
shows that the first partition is available (denoted by the letter "U") and the second partition is
offline (denoted by the underscore).
Replacing a Failed Disk Drive
Once a hard disk drive fails, replace it immediately to preserve the data redundancy that
RAID1provides.
See your system documentation for instructions on replacing your failed hard drive with a
new hard drive.
Partitioning the Replacement Drive
Once the failed disk drive has been replaced, restore the partitions that were saved earlier in
the
/raidinfo
directory.
For replacing drive
sda,
restore the original partition scheme for
sda
to the new hard drive
by typing:
sfdisk /dev/sda < /raidinfo/partitions.sda
For replacing drive
sdb,
restore the original partition scheme for
sdb
to the new hard drive
by typing:
sfdisk /dev/sdb < /raidinfo/partitions.sdb
Software RAID with Red Hat Enterprise Linux 4 7
Adding the RAID Partitions Back Into the md Device
Next, add the partitions back into each RAID device.
To add partition sdb1 back into the md0 device and to rebuild the data on that partition,
use the following command:
mdadm –a /dev/md0 /dev/sdb1
While the partition is rebuilding, track the status by running the
watch
cat /proc/mdstat
command, which displays the status and percentage of rebuilding completed. The status is
displayed similar to the following:
md2 : active raid1 sdb3[2] sda3[0]
5116608 blocks [2/1] [U_][=>..............] recovery = 7.7%
(397888/5116608) finish=1.7mins
Once the rebuilding is finished,
watch
cat /proc/mdstat
shows the following output
for the example device:
md0 : active raid1] sda1[0] sdb1[1]
104320 blocks [2/2] [UU]
Use the
mdadm –a
command to add each partition back into its respective RAID device.
Once all the partitions have been added, run the GRUB commands discussed in “Preparing the
System for Drive Failure” to install GRUB on the MBR of the new disk. After this step,
the RAID configuration will be fully restored.
8 Software RAID with Red Hat Enterprise Linux 4
www.dell.com | support.dell.com
www.dell.com | support.dell.com
Dell™ 操作系统 RAID
Red Hat
®
Enterprise Linux 4
提供的软件 RAID
注和注意
注:注表示可以帮助您更好地使用计算机的重要信息。
注意:注意表示可能会损坏硬件或导致数据丢失,并告诉您如何避免此类问题。
____________________
本文件中的信息如有更改,恕不另行通知。
© 2005 Dell Inc.
版权所有,翻印必究。
未经
Dell Inc.
书面许可,不得以任何方式进行复制。
本文中使用的商标:
Dell
DELL
徽标是
Dell Inc.
的商标;
Red Hat
Red Hat Corporation
的注册商标。
本文件中述及的其它商标和产品名称是指拥有相应商标和名称的公司或其制造的产品。
Dell Inc.
对本公司的商标和产品名称之外的其它商标和产品名称不拥有任何专有权。
2005
4
P/N CC202 Rev. A00
Red Hat Enterprise Linux 4 提供的软件 RAID 11
配置和管理
Red Hat
®
Enterprise Linux 4
提供的软件
RAID
软件
RAID
的经济性日益增加,这为
Linux
系统管理员提供了一种替代方法,可代替较昂贵的
基于硬件的
RAID
实现。这应归功于
Linux
操作系统的性能和成本优势以及处理器功率方面的
快速提高。使用
Red Hat Enterprise Linux 4
中的软件
RAID
层和管理工具,您可以建立最能满
足您需要的经济有效的软件
RAID
实现。
Linux
操作系统安装期间创建软件
RAID
阵列
完成以下各节所述的步骤,创建每个软件
RAID
设备。
创建软件
RAID
引导分区
创建软件
RAID
交换分区
创建软件
RAID root
分区
创建其他的软件
RAID
分区
在创建软件
RAID
之前,必须对硬盘驱动器进行分区。分区允许您将硬盘驱动器分为独立的
几个部分,每个部分均可当成硬盘驱动器来使用。在操作系统安装期间,会提示您在
Disk
Partitioning Setup
(磁盘分区设置)屏幕上对硬盘驱动器进行分区。
Disk Partitioning Setup
(磁盘分区设置)屏幕提供两个选择:
Automatically partition
(自动分区)
Manually partition with Disk Druid
(使用
Disk Druid
手动分区)
注意: 如果对已经有数据的驱动器进行分区,数据将会丢失。
如果您不想手动控制系统分区,请选择
Automatically partition
(自动分区),让安装程序为
您分区。要手动对驱动器进行分区,请选择
Manually partition with Disk Druid
(使用
Disk
Druid
手动分区)并单击
Next
(下一步)。通过选择任何现有的设备和分区并单击
Delete
(删除)可删除设备和分区。必须先删除设备,然后再删除分区。
创建软件
RAID
引导分区
1
要创建软件
RAID
分区,请单击
RAID
并选择
Create a software RAID partition
(创建软件
RAID
分区)单击
OK
(确定)
2
对于文件系统类型,请选择
Software RAID
(软件
RAID
确保为分区只选择一个驱动器
(例如
sda
,大
100 MB
,并
Fixed Size
(固定大小)框。单击
OK
(确定)继续。
3
重复步骤
1
2
在第二个硬盘驱动器(例如
sdb
)上
RAID
分区
12 Red Hat Enterprise Linux 4 提供的软件 RAID
www.dell.com | support.dell.com
4
再次单击
RAID
,选
Create a RAID device
(创建
RAID
设备)后单击
OK
(确定)
5
为安装点类型选择
/boot
,并
ext3
作为文件系统类型,
md0
作为
RAID
设备,
以及
RAID 1
作为
RAID
级别。单击
OK
(确定)
创建软件
RAID
交换分区
1
要创建软件
RAID
分区,请单击
RAID
并选择
Create a software RAID partition
(创建软件
RAID
分区)单击
OK
(确定)
2
对于文件系统类型,请选择
Software RAID
(软件
RAID
确保为分区只选择一个驱动器
(例如
sda
大小为系统
RAM
内存的两倍,并选择
Fixed Size
(固定大小)框。
单击
OK
(确定)继续。
3
重复步骤
1
2
在第二个硬盘驱动器(例如
sdb
上创建
RAID
分区
4
再次单击
RAID
,选
Create a RAID device
(创建
RAID
设备)然后单击
OK
(确定)
5
为文件系统类型选择
swap
并选择
md1
作为
RAID
设备,以及
RAID 1
作为
RAID
级别。
单击
OK
(确定)
创建软件
RAID Root
分区
1
要创建软件
RAID
分区,请单击
RAID
并选择
Create a software RAID partition
(创建软件
RAID
分区)单击
OK
(确定)
2
对于文件系统类型,请选择
Software RAID
(软件
RAID
确保为分区只选择一个驱动器
(例如
sda
输入所需的
root
分区大小,并选择
Fixed Size
(固定大小)框。单击
OK
(确
定)继续。
3
重复步骤
1
2
在第二个硬盘驱动器(例如
sdb
上创建
RAID
分区。
4
再次单击
RAID
,选
Create a RAID device
(创建
RAID
设备)然后单击
OK
(确定)
5
选择
/
作为安装点类型,
ext3
作为文件系统类型,
md2
作为
RAID
设备,
以及
RAID 1
作为
RAID
级别。单击
OK
(确定)
创建其他的软件
RAID
分区
1
要创建软件
RAID
分区,请单击
RAID
并选择
Create a software RAID partition
(创建软件
RAID
分区)单击
OK
(确定)
2
对于文件系统类型,请选择
Software RAID
(软件
RAID
确保为分区只选择一个驱动器
(例如
sda
输入所需的分区大小,并选择
Fixed Size
(固定大小)框。单击
OK
(确定)
继续。
3
重复步骤
1
2
在第二个硬盘驱动器(例如
sdb
上创建
RAID
分区
Red Hat Enterprise Linux 4 提供的软件 RAID 13
4
再次单击
RAID
,选
Create a RAID device
(创建
RAID
设备)然后单击
OK
(确定)
5
选择安装点类型、文件系统类型和
RAID
设备,并选择
RAID 1
作为
RAID
级别。
单击
OK
(确定)
在创建所有分区之后,单击
Next
(下一步)。
准备系统,以防驱动器故障
本节提供了有关准备系统以便对故障驱动器恢复
RAID
配置的信息。在
RAID
设备进行了配
置,且操作系统安装之后,您可以:
创建分区表的备份副本
在每个驱动器的主引导记录
(MBR)
上安装
GRUB
(多重启动管理器)
复制分区表
要复制分区表,请创建存储分区信息的目录,并使用
sfdisk
命令将每个磁盘的分区信息文
件写入该目录中。
mkdir /raidinfo
sfdisk -d /dev/sda > /raidinfo/partitions.sda
sfdisk -d /dev/sdb > /raidinfo/partitions.sdb
两个驱动器的分区表存储在镜像分区上,这样,万一某个驱动器发生故障,另一个驱动器包
含相关的分区信息,可以使用该信息重建分区。
MBR
上安装
GRUB
RAID
配置和操作系统安装过程中,只会在主硬盘驱动器
(
sda
)
MBR
上安装
GRUB
。但
是,如果主硬盘驱动器出现故障,系统只能使用引导盘来引导。为了避免这种问题,请在每
个驱动器的
MBR
上安装
GRUB
要在次驱动器的
MBR
上安装
GRUB
,请将次驱动器暂时定义为主磁盘。为此,将
sdb
标识
hd0
并指示
GRUB
MBR
写入次驱动器。
要进入
GRUB
命令解释程序,请在命令提示符下键入
grub
grub>
提示符下:
device (hd0) /dev/sdb
root (hd0,0)
setup (hd0)
GRUB
将显示
setup
命令执行时所有在后台运行的命令,然后返回一条信息,说明
setup
命令
已成功。现在,两个驱动器都有
MBR
,系统使用哪一个驱动器都可以引导。
14 Red Hat Enterprise Linux 4 提供的软件 RAID
www.dell.com | support.dell.com
在驱动器发生故障后恢复
RAID
配置
如果软件
RAID 1
阵列中的硬盘驱动器出现故障,您可以通过执行一个包含三个步骤的过程,
RAID
阵列恢复到新驱动器上:
换故障驱动器
对替代的驱动器进行分区
RAID
分区重新添
md
设备中
如果您怀疑某个驱动器发生故障,可以使用以下命令检查每个
RAID
设备的状态
cat /proc/mdstat
例如,如果系统的
md0
设备丢失一个分区,会显示以下信息:
md0 : active raid1 sda1[0]
104320 blocks [2/1] [U_]
该输出表示
md0
作为
RAID 1
设备处于状态,并且在该
RAID
设备中分区
sda1
当前处于
状态。输出
[
2/1
]
指示应该有两个分区可供该设备使用(第一个),但是,当前只有
一个可用(第二个)。输出
[
U_
]
显示第一个分区可用(由字母
U
”表示),第二个分区
脱机划线表示)。
更换故障硬盘驱动器
硬盘驱动器发生故障,请立将其换,以保
RAID 1
提供的数据冗余
有关用硬盘驱动器换故障硬盘驱动器的说明,请参阅系统说明文件。
对替代的驱动器进行分区
在故障硬盘驱动器换之后,请恢复先前保存在
/raidinfo
目录中的分区。
如果换的是驱动器
sda
,请键入以下命令,将
sda
原始分区方恢复至新硬盘驱动器:
sfdisk /dev/sda < /raidinfo/partitions.sda
如果换的是驱动器
sdb
,请键入以下命令,将
sdb
原始分区方恢复至新硬盘驱动器:
sfdisk /dev/sdb < /raidinfo/partitions.sdb
Red Hat Enterprise Linux 4 提供的软件 RAID 15
RAID
分区重新添加到
md
设备中
下来,将分区重新添每个
RAID
设备中。
要将分区
sdb1
新添
md0
设备中并重建该分区上的数据,请使用以下命令:
mdadm -a /dev/md0 /dev/sdb1
当分区在重建时,请运行
watch
cat /proc/mdstat
命令来跟踪状态,该命令将显示
和已完成的重建。显示的状态如下所示:
md2 : active raid1 sdb3[2] sda3[0]
5116608 blocks [2/1] [U_][=>..............] recovery = 7.7%
(397888/5116608) finish=1.7mins
在重建完成之后,
watch
cat /proc/mdstat
对于示例设备将显示以下输出:
md0 : active raid1] sda1[0] sdb1[1]
104320 blocks [2/2] [UU]
请使用
mdadm -a
命令将每个分区重新添各自的
RAID
设备中。
加所有分区之后,运行“准备系统,以驱动器故障”中所述的
GRUB
命令,
以便在磁盘的
MBR
上安装
GRUB
。执行此步骤之后,
RAID
配置将完恢复。
16 Red Hat Enterprise Linux 4 提供的软件 RAID
www.dell.com | support.dell.com
www.dell.com | support.dell.com
Dell™ - Configuration du RAID
par le système d'exploitation
RAID logiciel avec Red Hat
®
Enterprise Linux 4
Remarques et avis
REMARQUE : une REMARQUE indique des informations importantes qui peuvent vous aider à mieux utiliser
votre ordinateur.
AVIS : un AVIS vous avertit d'un risque de dommage matériel ou de perte de données et vous indique comment éviter
le problème.
____________________
Les informations contenues dans ce document peuvent être modifiées sans préavis.
© 2005 Dell Inc. Tous droits réservés.
La reproduction de ce document de quelque manière que ce soit sans l'autorisation écrite de Dell Inc. est strictement interdite.
Marques utilisées dans ce document : Dell et le logo DELL sont des marques de Dell Inc. ; Red Hat est une marque déposée
de Red Hat Corporation.
Tous les autres noms de marques et marques commerciales utilisés dans ce document se rapportent aux sociétés propriétaires des marques et
des noms de ces produits. Dell Inc. décline tout intérêt dans l'utilisation des marques déposées et des noms de marques ne lui appartenant pas.
Avril 2005 P/N CC202 Rev. A00
/