Re: Reshape 3-drive RAID1 into 3-drive RAID-5

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

 



On Tue, Nov 15, 2011 at 3:40 PM, NeilBrown <neilb@xxxxxxx> wrote:
> On Tue, 15 Nov 2011 16:11:43 -0500 Phil Turmel <philip@xxxxxxxxxx> wrote:
<SNIP>
>>
>> In your case, the data can be retained, and even remain in use, as follows:
>>
>> 1) Drop the third device and wipe its superblock.
>>
>> mdadm /dev/md6 --fail /dev/sdc6 --remove /dev/sdc6
>> mdadm --zero-superblock /dev/sdc6
>
> 1a/ Convert the 2-drive RAID1 to a 2-drive RAID1:
>  mdadm --grow /dev/md6 --raid-devices=2
>
>>
>> 2) Convert 2-drive raid1 to 2-drive raid5.  Due to a quirk of the parity math, the second drive contains the same data as the first, and Neil has optimized this conversion to be instant.  (I don't know what version that became true, but I believe it has been a while.)
> When RAID1->RAID5 conversion was first implemented it was instant - 2.6.30.
>
>>
>> mdadm /dev/md6 --grow --level=5
>>
>> 3) Add third drive as a spare:
>>
>> mdadm /dev/md6 --add /dev/sdc6
>>
>> 4) Reshape/grow to use the new space.  MD will re-arrange the blocks and compute parity as it goes, without disturbing the running filesystem.  You probably need a backup-file option as well...  mdadm will tell you if it needs it.
>
> You won't.  Backups is only needed for the first 6 stripes, and the spare can
> be used for that.
>
>>
>> mdadm /dev/md6 --grow --raid-devices=3
>>
>> 5) Resize your filesystem to use the additional space.
>>
>> .... (varies, some FS can do it on the run.)
>>
>> >
>> > Thanks,
>> > Mark
>>
>> HTH,
>>
>> Phil
>
> NeilBrown
>

Hi all,
   After reading through your responses and going over the man pages I
got started. Here's the set of commands I have executed so far:

mdadm /dev/md6 --fail /dev/sdc6 --remove /dev/sdc6
mdadm --zero-superblock /dev/sdc6
mdadm --grow /dev/md6 --raid-devices=2

At this point I appear to have a good 2-drive RAID-1:

md6 : active raid1 sda6[0] sdb6[1]
      247416933 blocks super 1.1 [2/2] [UU]

The next command was supposed to convert it to RAID-5 but doesn't work
for me so far:

c2stable ~ # mdadm --grow /dev/md6 --level=5
mdadm: /dev/md6: could not set level to raid5
c2stable ~ #

   I currently have mdadm-3.1.4 install. Gentoo portage has 3.1.5
marked as testing which I can install if required. Kernel is
3.1.1-gentoo.

   Can you see what I'm doing wrong? I was wondering whether mdadm
needs something like --raid-devices=2 to know this is a special
conversion case but don't want to make any stupid mistakes.

Thanks,
Mark

c2stable ~ # mdadm -D /dev/md6
/dev/md6:
        Version : 1.1
  Creation Time : Thu Apr 15 10:45:35 2010
     Raid Level : raid1
     Array Size : 247416933 (235.96 GiB 253.35 GB)
  Used Dev Size : 247416933 (235.96 GiB 253.35 GB)
   Raid Devices : 2
  Total Devices : 2
    Persistence : Superblock is persistent

    Update Time : Thu Nov 17 13:27:20 2011
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           Name : c2stable:6  (local to host c2stable)
           UUID : 249c7331:a8203540:c8f3b020:fb30a66b
         Events : 1039

    Number   Major   Minor   RaidDevice State
       0       8        6        0      active sync   /dev/sda6
       1       8       22        1      active sync   /dev/sdb6
c2stable ~ #
--
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


[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