Thread (6 messages) 6 messages, 3 authors, 2014-11-05

Re: Trying to get POLICY working

From: NeilBrown <hidden>
Date: 2014-11-01 00:20:01
Subsystem: the rest · Maintainer: Linus Torvalds

On Fri, 31 Oct 2014 16:19:04 +0100 Caspar Smit [off-list ref] 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.

Thanks,
NeilBrown

Well, i know there is no MD superblock on /dev/sdd but shouldn't the
policy setting kick in here and add /dev/sdd as spare (and hence start
rebuilding) to /dev/md0?

mdadm version: 3.2.5-5 (latest debian wheezy stable)
kernel version: 3.2.63-2 (latest debian wheezy stable)

Kind regards,
Caspar Smit
--
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
  

Attachments

  • (unnamed) [application/pgp-signature] 828 bytes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help