linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Caspar Smit <c.smit@truebit.nl>
Cc: linux-raid@vger.kernel.org
Subject: Re: Trying to get POLICY working
Date: Mon, 3 Nov 2014 12:54:16 +1100	[thread overview]
Message-ID: <20141103125416.629a4810@notabene.brown> (raw)
In-Reply-To: <20141101112001.344e5f20@notabene.brown>

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

On Sat, 1 Nov 2014 11:20:01 +1100 NeilBrown <neilb@suse.de> wrote:

> On Fri, 31 Oct 2014 16:19:04 +0100 Caspar Smit <c.smit@truebit.nl> wrote:
> 
> > Hi all,
> > 
> > I'm trying to get the POLICY framework of mdadm working but I can't seem to.
> > 
> > As i understand in the man page of mdadm the Incremental and POLICY
> > directives could allow adding a new disk without MD superblock as
> > spare to an already active array:
> > 
> > "Note that mdadm will normally only add devices to an array which were
> > previously working (active or spare) parts of that array.  The support
> > for automatic inclusion of a new drive as a spare in some array
> > requires a configuration through POLICY in config file."
> > 
> > Furthermore:
> > 
> > "If no md metadata is found, the device may be still added to an array
> > as a spare if POLICY allows."
> > 
> > 
> > To get the basics working I created a system with 3 disks /dev/sdb,
> > /dev/sdc and /dev/sdd
> > 
> > Created a RAID5 with one missing disk:
> > 
> > mdadm -C /dev/md0 -l 5 -n 3 /dev/sd[b-c] missing
> > 
> > I set the POLICY in mdadm.conf to:
> > 
> > POLICY action=force-spare
> > 
> > This should add any device (passed through mdadm --incremental) as
> > spare no matter what (Am i correct?)
> 
> That is the theory, yes.
> 
> > 
> > Now when I do:
> > 
> > #mdadm --incremental /dev/sdd
> > mdadm: no RAID superblock on /dev/sdd.
> 
> The message suggests that 'guess_super' found something on the device, but
> it didn't turn out to be something useful.... not very helpful I know.
> 
> What does "mdadm --examine /dev/sdd" report?
> I suspect there is a partition table and that is causing the confusion.
> Try removing the partition table (dd /dev/zero to the device for a few K).
> Then try again.
> 
> Probably need a fix like:
> 
> diff --git a/Incremental.c b/Incremental.c
> index c9372587f518..3156190c4603 100644
> --- a/Incremental.c
> +++ b/Incremental.c
> @@ -196,7 +196,7 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
>  	policy = disk_policy(&dinfo);
>  	have_target = policy_check_path(&dinfo, &target_array);
>  
> -	if (st == NULL && (st = guess_super(dfd)) == NULL) {
> +	if (st == NULL && (st = guess_super_type(dfd, guess_array)) == NULL) {
>  		if (c->verbose >= 0)
>  			pr_err("no recognisable superblock on %s.\n",
>  			       devname);
> 
> 
> and probably should improve the error messages...
> 
> Thanks for the report.  Please let me know if that works, and what other
> difficulties you hit.

Actually, don't bother.  I must have been asleep.

Your problem is that you haven't defined a 'domain'.
A new spare needs to be assigned to a 'domain', and it will be attached to
any array in the same domain, as needed.

You can give all devices the domain "default" with

   POLICY domain=default

The domain of an array is inherited from the member devices, or can be set
with "spare-group=" in mdadm.conf.

So

   POLICY domain=default action=force-spare

should make it work for you.

NeilBrown

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

  reply	other threads:[~2014-11-03  1:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-31 15:19 Trying to get POLICY working Caspar Smit
2014-10-31 15:34 ` Robin Hill
2014-11-01  0:20 ` NeilBrown
2014-11-03  1:54   ` NeilBrown [this message]
2014-11-03  9:43     ` Caspar Smit
2014-11-05  5:28       ` NeilBrown

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=20141103125416.629a4810@notabene.brown \
    --to=neilb@suse.de \
    --cc=c.smit@truebit.nl \
    --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).