old-www/FAQ/Linux-RAID-FAQ/x37.html

1035 lines
18 KiB
HTML

<HTML
><HEAD
><TITLE
>Linux RAID FAQ</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Linux-RAID FAQ"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Linux-RAID FAQ"
HREF="index.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Linux-RAID FAQ</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="index.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
>&nbsp;</TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="AEN37"
></A
>1. Linux RAID FAQ</H1
><DIV
CLASS="qandaset"
><DL
><DT
>1. <A
HREF="x37.html#general"
>General</A
></DT
><DD
><DL
><DT
>1.1.1. <A
HREF="x37.html#AEN43"
>Where can I find archives for the linux-raid mailing
list?</A
></DT
><DT
>1.1.2. <A
HREF="x37.html#AEN49"
>Where can I find the latest version of this FAQ?</A
></DT
><DT
>1.1.3. <A
HREF="x37.html#AEN55"
>What sorts of things does this list cover?</A
></DT
></DL
></DD
><DT
>2. <A
HREF="x37.html#kernel"
>Kernel</A
></DT
><DD
><DL
><DT
>1.2.1. <A
HREF="x37.html#AEN62"
>I'm running <TT
CLASS="replaceable"
><I
>[insert your linux distribution
here]</I
></TT
>. Do I need to patch my kernel to make RAID
work?</A
></DT
><DT
>1.2.2. <A
HREF="x37.html#AEN69"
>How can I tell if I need to patch my kernel?</A
></DT
><DT
>1.2.3. <A
HREF="x37.html#AEN85"
>Where can I get the latest RAID patches for my kernel?</A
></DT
><DT
>1.2.4. <A
HREF="x37.html#AEN95"
>How do I apply the patch to a kernel that I just
downloaded from ftp.kernel.org?</A
></DT
><DT
>1.2.5. <A
HREF="x37.html#AEN109"
>What kind of drives can I use RAID with? Do only SCSI or
IDE drives work? Do I need different patches for different kinds
of drives?</A
></DT
></DL
></DD
><DT
>3. <A
HREF="x37.html#tools"
>RAID tools</A
></DT
><DD
><DL
><DT
>1.3.1. <A
HREF="x37.html#AEN116"
>What tools are available for dealing with my Linux Software RAID
arrays?</A
></DT
></DL
></DD
><DT
>4. <A
HREF="x37.html#failrecover"
>Disk Failures and Recovery</A
></DT
><DD
><DL
><DT
>1.4.1. <A
HREF="x37.html#AEN129"
>How can I tell if one of the disks in my RAID array has
failed?</A
></DT
><DT
>1.4.2. <A
HREF="x37.html#AEN145"
>So my RAID set is missing a disk, what do I do now?</A
></DT
><DT
>1.4.3. <A
HREF="x37.html#AEN160"
><B
CLASS="command"
>dmesg</B
> shows <SPAN
CLASS="QUOTE"
>"md: serializing resync,
<TT
CLASS="replaceable"
><I
>md4</I
></TT
> has overlapping physical units
with <TT
CLASS="replaceable"
><I
>md5</I
></TT
>"</SPAN
> (where md4 and md5 are two
of your software RAID devices). What does this mean?</A
></DT
></DL
></DD
><DT
>5. <A
HREF="x37.html#benchmarking"
>Benchmarking</A
></DT
><DD
><DL
><DT
>1.5.1. <A
HREF="x37.html#AEN172"
>How should I benchmark my RAID devices? Are there any
tools that work particularly well?</A
></DT
></DL
></DD
></DL
><DIV
CLASS="qandadiv"
><H3
><A
NAME="general"
></A
>1. General</H3
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN43"
></A
><B
>1.1.1. </B
>Where can I find archives for the linux-raid mailing
list?</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>The only archives left seem to be available at <A
HREF="http://marc.theaimsgroup.com/?l=linux-raid&r=1&w=2"
TARGET="_top"
>http://marc.theaimsgroup.com/?l=linux-raid&#38;r=1&#38;w=2</A
></P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN49"
></A
><B
>1.1.2. </B
>Where can I find the latest version of this FAQ?</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>The latest version of this FAQ will be available from the
LDP website at <A
HREF="http://www.tldp.org/FAQ/"
TARGET="_top"
>http://www.tldp.org/FAQ/</A
>.</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN55"
></A
><B
>1.1.3. </B
>What sorts of things does this list cover?</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>Well, obviously this list covers RAID in relation to
Linux. Most of the discussions are related to the raid code
that's been built into the Linux kernel. There are also a few
discussions on getting hardware based RAID controllers working
using Linux as the operating system. Any and all of these
discussions are valid for this list.</P
></DIV
></DIV
></DIV
><DIV
CLASS="qandadiv"
><H3
><A
NAME="kernel"
></A
>2. Kernel</H3
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN62"
></A
><B
>1.2.1. </B
>I'm running <TT
CLASS="replaceable"
><I
>[insert your linux distribution
here]</I
></TT
>. Do I need to patch my kernel to make RAID
work?</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>At this point, most major distributions are shipping with a 2.4
based kernel, which already includes the necessary patches. If your
distribution is still using a 2.2.x kernel, upgrade!</P
><P
>&#13; If you download a 2.2.x kernel from ftp.kernel.org, then you
will need to patch your kernel.</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN69"
></A
><B
>1.2.2. </B
>How can I tell if I need to patch my kernel?</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>That depends on which kernel series you're using. If
you're using the 2.4.x kernels, then you've already got the
latest RAID code that's available. If you're running 2.2.x, see
the following instructions on how to find out.</P
><P
>The easiest way is to check what's in
<TT
CLASS="filename"
>/proc/mdstat</TT
>. Here's a sample from a 2.2.x
kernel, <EM
>with</EM
> the RAID patches applied.
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>
[gleblanc@grego1 gleblanc]$ cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid5] [translucent]
read_ahead not set
unused devices: &#60;none&#62;
</PRE
></FONT
></TD
></TR
></TABLE
>
If the contents of <TT
CLASS="filename"
>/proc/mdstat</TT
> looks like the
above, then you don't need to patch your kernel.</P
><P
>The
"Personalities" line in your kernel may not look exactly like the
above, if you have RAID compiled as modules. Most distributions
will have RAID compiled as modules to save space on the boot
diskette. If you're not using any RAID sets, then you will
probably see a blank space at the end of the "Personalities"
line, don't worry, that just means that the RAID modules aren't
loaded yet.</P
><P
>Here's a sample from a 2.2.x kernel,
<EM
>without</EM
> the RAID patches applied.
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;
[root@serek ~]# cat /proc/mdstat
Personalities : [1 linear] [2 raid0]
read_ahead not set
md0 : inactive
md1 : inactive
md2 : inactive
md3 : inactive
</PRE
></FONT
></TD
></TR
></TABLE
>
<EM
>If your <TT
CLASS="filename"
>/proc/mdstat</TT
> looks like this
one, then you need to patch your kernel.</EM
></P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN85"
></A
><B
>1.2.3. </B
>Where can I get the latest RAID patches for my kernel?</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>The patches for the 2.2.x kernels up to, and including,
2.2.13 are available from <A
HREF="ftp://ftp.kernel.org/pub/linux/daemons/raid/alpha/"
TARGET="_top"
>ftp.kernel.org</A
>.
Use the kernel patch that most closely matches your kernel
revision. For example, the 2.2.11 patch can also be used on
2.2.12 and 2.2.13. <DIV
CLASS="important"
><P
></P
><TABLE
CLASS="important"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/important.gif"
HSPACE="5"
ALT="Important"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>These patches are no longer available
from this location! I haven't been able to find the new location for
them, please email me if you know where they've gone.</P
></TD
></TR
></TABLE
></DIV
>
</P
><P
>The patches for 2.2.14 and later kernels are at <A
HREF="http://people.redhat.com/mingo/raid-patches/"
TARGET="_top"
>http://people.redhat.com/mingo/raid-patches/</A
>.
Use the right patch for your kernel, these patches haven't
worked on other kernel revisions. Please use something like
wget/curl/lftp to retrieve this patch, as it's easier on the
server than using a client like Netscape. Downloading patches
with Lynx has been unsuccessful for me; wget may be the easiest
way.</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN95"
></A
><B
>1.2.4. </B
>How do I apply the patch to a kernel that I just
downloaded from ftp.kernel.org?</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>First, unpack the kernel into some directory, generally
people use <TT
CLASS="filename"
>/usr/src/linux</TT
>.
Change to this directory, and type <B
CLASS="command"
>patch -p1 &#60;
/path/to/raid-version.patch</B
>.
<DIV
CLASS="informalexample"
><A
NAME="AEN101"
></A
><P
></P
><P
>On my RedHat 6.2 system, I decompressed the 2.2.16 kernel
into <TT
CLASS="filename"
>/usr/src/linux-2.2.16</TT
>. From
<TT
CLASS="filename"
>/usr/src/linux-2.2.16</TT
>, I
type in <B
CLASS="command"
>patch -p1 &#60;
<TT
CLASS="replaceable"
><I
>/home/gleblanc/raid-2.2.16-A0</I
></TT
></B
>.
Then I rebuild the kernel using <B
CLASS="command"
>make
menuconfig</B
> and related builds.</P
><P
></P
></DIV
>
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN109"
></A
><B
>1.2.5. </B
>What kind of drives can I use RAID with? Do only SCSI or
IDE drives work? Do I need different patches for different kinds
of drives?</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>Software RAID works with any block device in the Linux
kernel. This includes IDE and SCSI drives, as well as most
harware RAID controllers. There are no different patches for IDE
drives vs. SCSI drives.</P
></DIV
></DIV
></DIV
><DIV
CLASS="qandadiv"
><H3
><A
NAME="tools"
></A
>3. RAID tools</H3
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN116"
></A
><B
>1.3.1. </B
>What tools are available for dealing with my Linux Software RAID
arrays?</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>There are currently two sets of tools available. Both sets work
quite well, and have essentially the same functionalty. I recommend the
newer set of tools, because they're much easier to use, but I'll mention
where to get the older tools as well.</P
><P
>The new set of tools is called <SPAN
CLASS="application"
>mdadm</SPAN
>.
It doesn't have much of a homepage, but you can download tarballs and
RPMs from <A
HREF="http://www.cse.unsw.edu.au/~neilb/source/mdadm/"
TARGET="_top"
>http://www.cse.unsw.edu.au/~neilb/source/mdadm/</A
>.
I suggest that anyone who isn't already familar with the 'raidtools'
package use these (and in fact, I suggest that folks who already know the
raidtools package switch over to these).</P
><P
>The older set of tools is called
<SPAN
CLASS="application"
>raidtools</SPAN
>. They're available from <A
HREF="http://people.redhat.com/mingo/raidtools/"
TARGET="_top"
>http://people.redhat.com/mingo/raidtools/</A
>.
I believe there are other locations available, since Red Hat Linux is
shipping based on a tarball numbered 1.00.3, which I can't find online.
If anybody knows where these are, please let me know.</P
></DIV
></DIV
></DIV
><DIV
CLASS="qandadiv"
><H3
><A
NAME="failrecover"
></A
>4. Disk Failures and Recovery</H3
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN129"
></A
><B
>1.4.1. </B
>How can I tell if one of the disks in my RAID array has
failed?</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>A couple of things should indicate when a disk has failed.
There should be quite a few messages in
<TT
CLASS="filename"
>/var/log/messages</TT
> indicating errors
accessing that device, which should be a good indication that
something is wrong.</P
><P
>You should also notice that your
<TT
CLASS="filename"
>/proc/mdstat</TT
> looks different. Here's a snip
from a good /proc/mdstat
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>
[gleblanc@grego1 gleblanc]$ cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid5] [translucent]
read_ahead not set
md0 : active raid1 sdb5[0] sda5[1] 32000 blocks [2/2] [UU]
unused devices: &#60;none&#62;
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>And here's one from a <TT
CLASS="filename"
>/proc/mdstat</TT
>
where one of the RAID sets has a missing disk.
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>
[gleblanc@grego1 gleblanc]$ cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid5] [translucent]
read_ahead not set
md0 : active raid1 sdb5[0] sda5[1] 32000 blocks [2/1] [U_]
unused devices: &#60;none&#62;
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>I don't know if <TT
CLASS="filename"
>/proc/mdstat</TT
> will
reflect the status of a HOT SPARE. If you have set one up, you
should be watching <TT
CLASS="filename"
>/var/log/messages</TT
> for any
disk failures. I'd like to get some logs of a disk failure, and
<TT
CLASS="filename"
>/proc/mdstat</TT
> from a system with a hot
spare.</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN145"
></A
><B
>1.4.2. </B
>So my RAID set is missing a disk, what do I do now?</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>Software-RAID generally doesn't mark a disk as bad unless it is, so
you probably need a new disk. Most decent quality disks have a 3 year
warranty, but some exceptional (and expensive) SCSI hard drives may have
wararnties as long as 5 years, or even longer. More and more hard drive
vendors are giving a 1 year warranty on their "consumer" drives. I
suggest avoiding any drive with a 1 year warranty if at all possible.
Try to have the manufacturer replace the failed disk if it's still under
warranty.</P
><P
>When you get the new disk, power down the system, and install it,
then partition the drive so that it has partitions the size of your
missing RAID partitions. Once you have the partitions set up properly,
just run <B
CLASS="command"
>mdadm --add <TT
CLASS="replaceable"
><I
>/dev/md0</I
></TT
>
<TT
CLASS="replaceable"
><I
>/dev/hdc1</I
></TT
></B
>, where
<TT
CLASS="replaceable"
><I
>/dev/md0</I
></TT
> is the RAID array you're adding the
partition to, and <TT
CLASS="replaceable"
><I
>/dev/hdc1</I
></TT
> is the partition
that you're trying to add. Reconstruction should start
immediately.</P
><P
>If you would prefer to use the RAIDtools suite, you can use the
command <B
CLASS="command"
>raidhotadd</B
> to put the new disk into the array
and begin reconstruction. See <A
HREF="http://www.LinuxDoc.org/HOWTO/Software-RAID-HOWTO-6.html"
TARGET="_top"
>Chapter
6</A
> of the <A
HREF="http://www.LinuxDoc.org/HOWTO/Software-RAID-HOWTO.html"
TARGET="_top"
>Software
RAID HOWTO</A
> for more information.</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN160"
></A
><B
>1.4.3. </B
><B
CLASS="command"
>dmesg</B
> shows <SPAN
CLASS="QUOTE"
>"md: serializing resync,
<TT
CLASS="replaceable"
><I
>md4</I
></TT
> has overlapping physical units
with <TT
CLASS="replaceable"
><I
>md5</I
></TT
>"</SPAN
> (where md4 and md5 are two
of your software RAID devices). What does this mean?</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>In that message <SPAN
CLASS="QUOTE"
>"physical units"</SPAN
> refers to
disks, and not to blocks on the disks. Since there is more than
one RAID array that needs resyncing on one of the disks in use for your
RAID arrays, the RAID code is going to sync md4 first, and md5 second, to
avoid excessive seeks (also called thrashing), which would drastically
slow the resync process.</P
></DIV
></DIV
></DIV
><DIV
CLASS="qandadiv"
><H3
><A
NAME="benchmarking"
></A
>5. Benchmarking</H3
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN172"
></A
><B
>1.5.1. </B
>How should I benchmark my RAID devices? Are there any
tools that work particularly well?</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>There are really a few options for benchmarking your RAID
array, depending on what you're looking to test. RAID offers the
greatest speed increases when there are multiple threads reading
from the same RAID volume.</P
><P
>One tool specificly designed to test and show off these
performance gains is <A
HREF="http://tiobench.sourceforge.net/"
TARGET="_top"
><SPAN
CLASS="application"
>tiobench</SPAN
></A
>. It uses
multiple read and write threads on the disk, and has some pretty
good reporting.</P
><P
>Another good tool to use is <A
HREF="http://www.coker.com.au/bonnie++/"
TARGET="_top"
><SPAN
CLASS="application"
>bonnie++</SPAN
></A
>. It
seems to be more targeted at benchmarking single drives that at
RAID, but still provides useful information.</P
><P
>One tool <EM
>NOT</EM
> to use is
<SPAN
CLASS="application"
>hdparm</SPAN
>. It does not give useful
performance numbers for any drives that I've heard about, and has
been known to give some incredibly off-the-wall numbers as well.
If you want to do <EM
>real</EM
> benchmarking, use
one of the tools listed above.</P
></DIV
></DIV
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>&nbsp;</TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Linux-RAID FAQ</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>&nbsp;</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>