Re: Raid 5 to Raid 1 (half of the data not required)

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

 



On Tue, 23 Aug 2011 19:41:11 -0400 Mike Viau <viaum@xxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
> 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@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