linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: hai wu <haiwu.us@gmail.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: mdadm rebuild
Date: Mon, 9 Dec 2013 09:53:28 +1100	[thread overview]
Message-ID: <20131209095328.0d39e6ad@notabene.brown> (raw)
In-Reply-To: <CAJ1=nZfUBQ0_T1s3deG+HOU7BQeayibWcW8y5h5bEjFt2tvhnA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3359 bytes --]

On Sun, 8 Dec 2013 16:45:08 -0600 hai wu <haiwu.us@gmail.com> wrote:

> Thanks Neil. I am not sure if I understand mdadm 'spare' correctly. If
> doing as you mentioned above, the new driver will show up in output of
> "mdadm --detail /dev/md0" as 'spare' status, while I would like the new
> drive to automatically show up as "acitve, sync", and it will automatically
> be synced up with the one remaining good drive upon running the udev rule.
> I don't see an option like "force-include" in this case. Please let me know
> if I miss something.

Whenever md notices that an array has a spare device and a missing device it
will start rebuilding the spare and will then make it an active device.

So if a new device is added to the system, you really do want to give it to
md as a 'spare'.  md will do the rest - it always has done.

NeilBrown


> 
> 
> On Sun, Dec 8, 2013 at 3:55 PM, NeilBrown <neilb@suse.de> wrote:
> 
> > On Sun, 8 Dec 2013 11:53:00 -0600 Hai Wu <haiwu.us@gmail.com> wrote:
> >
> > > I am wondering whether it is possible for mdadm to auto-rebuild a failed
> > > raid1 driver upon its replacement with a new drive? The following lines
> > > from some RedHat website URL seems to indicate vaguely that it might be
> > possible:
> > >
> >
> > Yes and no.
> > "yes" because it is certainly possible to arrange this,
> > "no" because it isn't just mdadm which does it.
> >
> > When a drive is plugged in, udev notices and can run various commands to do
> > things with that device.  You need to get udev to run "mdadm -I $devname"
> > when a new device is plugged in.
> > The udev scripts which come with mdadm will only do that for new drives
> > which
> > appear to be part of an array already.  You presumably want it to do that
> > for
> > any new drive.  The change should be quite easy.
> >
> > Secondly, you need to tell mdadm that it is OK to add a new device as a
> > spare
> > to an array.  To see how to do this you need to read the documentation for
> > the "POLICY" command in mdadm.conf.5.
> >
> > A line like:
> >     POLICY action=force-spare
> > tells mdadm that any device passed to "mdadm -I" can be added to any array
> > as
> > a spare.  You might not want that, but you can restrict it in various ways.
> >
> >     POLICY path=pci-0000:00:1f.2-scsi* action=spare
> >
> > says that any device attached to a particular controller can be added to
> > any
> > array as long as it is already a member of the array, or appears to be
> > blank.
> >
> > There are various other directives which should allow you to describe
> > whatever you want.
> >
> > NeilBrown
> >
> >
> > > Previously, mdadm was not able to rebuild newly-connected drives
> > > automatically. This update adds the array auto-rebuild feature and
> > allows a
> > > RAID stack to automatically rebuild newly-connected drives.
> > >
> > > The goal is to get mdadm software raid1 to behave the same as hardware
> > > raid1, when replacing failed hard drive. It should automatically detect
> > new
> > > drive and rebuild the new drive into part of raid1 ..--
> > > To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> >


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  parent reply	other threads:[~2013-12-08 22:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-08 17:53 mdadm rebuild Hai Wu
2013-12-08 21:55 ` NeilBrown
     [not found]   ` <CAJ1=nZfUBQ0_T1s3deG+HOU7BQeayibWcW8y5h5bEjFt2tvhnA@mail.gmail.com>
2013-12-08 22:53     ` NeilBrown [this message]
2013-12-08 23:03       ` Hai Wu
2013-12-08 23:17         ` NeilBrown
2013-12-08 23:56           ` Adam Goryachev
2013-12-09  0:16             ` NeilBrown
     [not found]   ` <CAJ1=nZcGO_GTUZ9bgrYJJXHoGQnepHyLof21xQ3MFwokfaCvCg@mail.gmail.com>
2013-12-09 22:17     ` NeilBrown
2013-12-08 21:56 ` Peter Grandi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131209095328.0d39e6ad@notabene.brown \
    --to=neilb@suse.de \
    --cc=haiwu.us@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).