Re: Howto start reshape from 100% when change readonly raid to readwrite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 11 Sep 2014 11:06:59 +0800 Apple Yin <bravery.apple@xxxxxxxxx> 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@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux