linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Mike Viau <viaum@sheridanc.on.ca>
Cc: linux-raid@vger.kernel.org
Subject: Re: Raid 5 to Raid 1 (half of the data not required)
Date: Wed, 24 Aug 2011 10:46:49 +1000	[thread overview]
Message-ID: <20110824104649.1c5696c3@notabene.brown> (raw)
In-Reply-To: <BAY148-W51F7F3A42E515F76BB76EFEF2E0@phx.gbl>

On Tue, 23 Aug 2011 19:41:11 -0400 Mike Viau <viaum@sheridanc.on.ca> wrote:

> 
> Hello,
> 
> I am trying to convert my currently running raid 5 array into a raid 1. All the guides I can see online are for the reverse direction in which one is converting/migrating a raid 1 to raid 5. I have intentionally only allocated exactly half of the total raid 5 size is. I would like to create the raid 1 over /dev/sdb1 and /dev/sdc1 with the data on the raid 5 running with the same drives plus /dev/sde1. Is this possible, I wish to have the data redundantly over two hard drive without the parity which is present in raid 5?

Yes this is possible, though you will need a fairly new kernel (late 30's at
least) and mdadm.

And you need to be running ext3 because I think it is the only one you can
shrink.

1/ umount filesystem
2/ resize2fs /dev/md0 490G
     This makes the array use definitely less than half the space.  It is 
     safest to leave a bit of slack for relocated metadata or something.
     If you don't make this small enough some later step will fail, and 
     you can then revert back to here and try again.

3/ mdadm --grow --array-size=490G /dev/md0
    This makes the array appear smaller without actually destroying any data.
4/ fsck -f /dev/md0
    This makes sure the filesystem inside the shrunk array is still OK.
    If there is a problem you can "mdadm --grow" to a bigger size and check
    again. 

Only if the above all looks ok, continue.  You can remount the filesystem at
this stage if you want to.

5/ mdadm --grow /dev/md0 --raid-disks=2

    If you didn't make the array-size small enough, this will fail.
    If you did it will start a 'reshape' which shuffles all the data around
    so it fits (With parity) on just two devices.

6/ mdadm --wait /dev/md0
7/ mdadm --grow /dev/md0 --level=1
    This instantly converts a 2-device RAID5 to a 2-device RAID1.
8/ mdadm --grow /dev/md0 --array-size=max
9/ resize2fs /dev/md0
     This will grow the filesystem up to fill the available space.

All done.

Please report success or failure or any interesting observations.

NeilBrown


> 
> Thanks for any help in advance :)
> 
> 
> # mdadm -D /dev/md0
> /dev/md0:
>         Version : 1.2
>   Creation Time : Mon Dec 20 09:48:07 2010
>      Raid Level : raid5
>      Array Size : 1953517568 (1863.02 GiB 2000.40 GB)
>   Used Dev Size : 976758784 (931.51 GiB 1000.20 GB)
>    Raid Devices : 3
>   Total Devices : 3
>     Persistence : Superblock is persistent
> 
>     Update Time : Tue Aug 23 11:34:00 2011
>           State : clean
>  Active Devices : 3
> Working Devices : 3
>  Failed Devices : 0
>   Spare Devices : 0
> 
>          Layout : left-symmetric
>      Chunk Size : 512K
> 
>            Name : HOST:0  (local to host HOST)
>            UUID : 7d8a7c68:95a230d0:0a8f6e74:4c8f81e9
>          Events : 55750
> 
>     Number   Major   Minor   RaidDevice State
>        0       8       17        0      active sync   /dev/sdb1
>        1       8       33        1      active sync   /dev/sdc1
>        3       8       65        2      active sync   /dev/sde1
> 
> 
> -M
>  		 	   		  --
> 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

--
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

  reply	other threads:[~2011-08-24  0:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-23 23:41 Raid 5 to Raid 1 (half of the data not required) Mike Viau
2011-08-24  0:46 ` NeilBrown [this message]
     [not found]   ` <BAY148-W29A568212EC52E4C4BC52EF110@phx.gbl>
2011-08-24  2:39     ` NeilBrown
2011-08-24  7:34       ` Robin Hill
2011-08-24  8:03 ` Gordon Henderson
2011-08-24  8:21   ` Mikael Abrahamsson
2011-08-24  8:42     ` NeilBrown
2011-08-26  0:11       ` Mike Viau

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=20110824104649.1c5696c3@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=viaum@sheridanc.on.ca \
    /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).