Linux 版 (精华区)
发信人: don (kick flaxs), 信区: Linux
标 题: raid on linux
发信站: 哈工大紫丁香 (2000年10月08日22:12:09 星期天), 站内信件
发信人: xshell (shell), 信区: GNULinux
标 题: Software Raid on linux
发信站: 饮水思源站 (Sun Oct 8 09:55:19 2000) , 转信
How to Setup Software RAID in Linux
by Cory R. Rauch
Want to setup software RAID on Linux? In this ar
ticle we will cover the installation and configuration of software RAI
D in Linux. If you are new to RAID, RAID is the combining of disks t
o increase stability, redundancy and performance. RAID stands for ''Re
dundant Array of Inexpensive Disks', and is divided into different RA
ID levels. Each level provides a different mix of performance & stabil
ity advantages. RAID can either be done in software or hardware. So w
hat RAID leve Software Raid for Linux supports 5 different RAID levels. Below is a
description of each RAID levels supported by Software RAID.
RAID
Level
Description
Linear
RAID-Linear simply strings together
multiple partitions and offers no s
tability
or performance advantages. But does
allow you to handily combine multip
le
partitions in to one big partition.
0
Similar to RAID-Linear except that
it
divides the partitions into stripes
that are
interleaved. This allows you to com
bine
multiple partitions into one big
partitions, and can increase disk
performance. This level offers no
stability advantages incase of disk
failure.
1
Sometimes also called "mirroring".
It
basically consists of two or more
partitions that keeps a exact copy
of each
other. So if one would fail the mi
rrored
image would kick in.
4
RAID-4 interleaves stripes of your
partitions and also maintains parit
y
information. This parity informatio
n can
be used to reconstruct a failed dis
k. It
offers both capacity and stability
advantages, but will degrade disk
performance.
5
Similar to RAID-4, It interleaves s
tripes
of your partitions, and also mainta
ins
parity information. This parity
information can be used to reconstr
uct a
failed disk. It offers both capacit
y and
stability advantages. It will not d
egrade
performance as badly as RAID-4 due
to a
method of alternating the stripes b
etween
each disks.
Each RAID level fits a particular scenario, so w
e will cover the configuration of each RAID level. Here is some design
tips when
laying out your RAID system.
When using IDE drives, you should connect only one
drive e
r I
DE controller. So if a controller fails it only brings down one
drive.
Try using Removable Drive Frames on your drives
for quick
drive swapping during drive failure. (I like GT's Removable Drive Fram
es: http://www.gtweb.net/mobile-rack.html)
SCSI Drives should be used in mission critical
situations,
because of better build quality and reliability (on average).
I have written these instructional specifically
for Red Hat 6.2 & 7 which come with all the raid tools needed. But the
basic ideas should work on other distribution. You may need to patch
the kernel on
other distributions and older versions of Red Hat and download the rai
d tools. You can get these files from the following URL:
ftp://ftp.fi.kernel.org/pub/linux/daemons/raid/
The /etc/raidtab file
The first step to configuring software raid in L
inux is to write a
/etc/raidtab file. Below is quick reference of w
hat each command
means, and I have provided examples of raidtab f
iles for each raid
level configuration.
raiddev /dev/mdX - This defines the device t
he raid array will
be addressed as.
raid-level N - This defines the raid level
nr-raid-disks N - This specifies the number
of raid disks
nr-spare-disks N - This specifies the number
of spare disks. A
spare disk is a disk that is used if a raid
disk fails.
chunk-size N - This defines chunk size (and
also refered to as
stripes). A raid partition is made up of chu
nks that are store
across each disk. The size of the chunks can
affect performance
for the better or for the worse. You could t
ry playing around
with these to increase performance.
RAID-Linear / RAID - 0
To setup RAID-Linear or RAID 0 you start with yo
ur multiple
partitions and list them in a /etc/raidtab file.
For instance, If I have
two partitions, /dev/hdb1 and /dev/hdd1, my raid
tab file would look
like this:
For RAID Linear
raiddev /dev/md0
raid-level linea
r
nr-raid-disks 2
chunk-size 32
persistent-superblock 1
device /dev/hdb1
raid-disk 0
device /dev/hdd1
raid-disk 1
and for RAID-0
raiddev /dev/md0
raid-level 0
nr-raid-disks 2
chunk-size 4
persistent-superblock 1
device /dev/hdb1
raid-disk 0
device /dev/hdd1
raid-disk 1
Next, type the following command:
mkraid /dev/md0
It will initialize the partitions, and you can n
ow use the raid partition
(in this case /dev/md0) as any other partition.
After you issue this command the configuration w
ill be constructed.
This can take anywhere from 30 minutes to an hou
r. You can check
its progress by checking the /proc/mdstat.
RAID-1
To setup RAID-1 or mirroring, you start with you
r partitions of
similar size and list them in a /dev/raidtab fil
e. Below is a example of
a RAID-1 raidtab file.
raiddev /dev/md0
raid-level 1
nr-raid-disks 2
nr-spare-disks 0
chunk-size 4
persistent-superblock 1
device /dev/hdb1
raid-disk 0
device /dev/hdd1
raid-disk 1
You can also define spare disks that can be used
in place of a disk that
has failed. Simply add there definition to the e
nd of the /etc/raiddev
file. You also need to alter the nr-spare-disk p
arameter to the
number of spare disks you want to use. A example
is below:
device /dev/hdc1
spare-disk 0
And finally initialize the raid with the followi
ng command:
mkraid /dev/md0
After you issue this command the configuration w
ill be constructed.
This can take anywhere from 30 minutes to an hou
r. You can check
its progress by checking the /proc/mdstat.
RAID-4 & RAID-5
To setup RAID-4 & RAID-5 simply list your partit
ions in
/etc/raidtab file. Below is a example of a RAID-
4 and RAID-5
raidtab file:
RAID-4:
raiddev /dev/md0
raid-level 4
nr-raid-disks 3
nr-spare-disks 0
persistent-superblock 1
chunk-size 32
device /dev/hdb1
raid-disk 0
device /dev/hdc1
raid-disk 1
device /dev/hdd1
raid-disk 2
RAID-5:
raiddev /dev/md0
raid-level 5
nr-raid-disks 3
nr-spare-disks 0
persistent-superblock 1
parity-algorithm left-symmetric
chunk-size 32
device /dev/hdb3
raid-disk 0
device /dev/hdc1
raid-disk 1
device /dev/hdd1
raid-disk 2
You can also define spare disks that can be used
in place of a disk that
has failed. Simply add there definition to the e
nd of the /etc/raiddev
file. You also need to alter the nr-spare-disk p
arameter to the
number of spare disks you want to use. A example
is below:
device /dev/hdc1
spare-disk 0
And finally initialize the raid with the followi
ng command:
mkraid /dev/md0
After you issue this command the configuration w
ill be constructed.
This can take anywhere from 30 minutes to an hou
r. You can check
its progress by checking the /proc/mdstat.
Starting and Stopping the RAID Array
To start or stop a raid array simply use the fol
lowing command:
To stop: raidstop /dev/[RAID ARRAY] (ex. md0)
To start: raidstart /dev/[RAID ARRAY] (ex. md0)
Conclusion
So I hope this article was a help to you, Softwa
re RAID can be a great
low-cost solution for a Linux RAID system. Pleas
e check back later
for our next Linux how-to.
--
※ 来源:.饮水思源站WWW bbs.sjtu.edu.cn. [FROM: 210.74.235.25]
--
一条驿路,一种氛围。
一朵梨花,一种思考。
希望能在Linux这条驿路上与你同行!
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: PR-AI.hit.edu.cn]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:207.940毫秒