From: NeilBrown <neilb@suse.de>
To: Apple Yin <bravery.apple@gmail.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: Howto start reshape from 100% when change readonly raid to readwrite
Date: Fri, 12 Sep 2014 14:05:32 +1000 [thread overview]
Message-ID: <20140912140532.7f8db3a2@notabene.brown> (raw)
In-Reply-To: <CAFvwrujsWB_zdvW0xfoGtOOrH5TH89m9CLEj-fBqn17N88LHpg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2759 bytes --]
On Thu, 11 Sep 2014 11:06:59 +0800 Apple Yin <bravery.apple@gmail.com> wrote:
> I met a prolem which confused me long time.
> Background:
> I have two machines which connected to the same HDDs, both of them are
> linux software raid. Machine 1 called Master, Machine 2 called Slave.
> Master can readwrite the HDD, Slave can read the HDD only.
>
> /dev/md1 was created on Master, and level is raid5 with 3 active
> disks + 1 spare disk. On slave I assemble the md1 as readonly with the
> same disks.Here is my steps:
> Create md1(raid5) on Master:
> #mdadm --create /dev/md1 -l 5 -n 3 -x 1 /dev/sd[bcde]
> Assemble md1(raid5) as readonly on Slave:
> #mdadm -A /dev/md1 /dev/sd[bcde] -o
>
>
> When Master doing the reshape(#mdadm --grow --raid-devices 4 /dev/md1
> ), Slave need to do the same reshape( #mdadm --grow --raid-devices 4
> /dev/md1).But md on Slave is readonly, so md_do_sync() not start.
> After Master finish the reshape, all data has moved from 3disks to
> 4disks. How can I ask Slave's md1 to start the reshape from 100% after
> set it to readwrite ? Here is my steps:
There is no way that you can make this reliable.
Even without a --grow happening, the read-only mount of changeable data could
end up very confused. You definitely cannot get md/raid5 to track the
changes made by another instance of md when reshaping.
If you unmount and --stop the array before starting the reshape, then
re-assemble and re-mount it, the more obvious probably should go away.
But it is likely there will still be less-obvious problems.
md might support clusters one day (though raid1 is much more likely than
raid5) but it certainly doesn't today.
I suggest you try to find a different solution to your underlying problem.
NeilBrown
>
> 1.On Slave, I modify the reshape_position_store() of md.c in kernel,
> to let user space to set reshape_position to “none” (100%):
> static ssize_t
> reshape_position_store(struct mddev *mddev, const char *buf, size_t len)
> {
> …
> if (cmd_match(buf, “none”))
> ;
> else if (buf == e || (*e && *e != ‘\n’))
> return -EINVAL;
>
> if (cmd_match(buf, “none”))
> mddev->reshape_position = MaxSector;
> else
> mddev->reshape_position = new;
> …
> }
> #echo none > /sys/block/md1/md/reshape_position
>
> 2. change readonly raid to readwrite on Slave
> #mdadm –readwrite /dev/md1
>
>
> Result: the reshape didn’t start . Slave's md1 size still the old size
> ( with 3 disk size)
>
>
>
> BRs,
> AppleYin
> --
> 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 --]
prev parent reply other threads:[~2014-09-12 4:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-11 3:06 Howto start reshape from 100% when change readonly raid to readwrite Apple Yin
2014-09-12 4:05 ` NeilBrown [this message]
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=20140912140532.7f8db3a2@notabene.brown \
--to=neilb@suse.de \
--cc=bravery.apple@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).