[CentOS] Software Raid Expert Needed

Sun Oct 5 22:15:40 UTC 2008
John R Pierce <pierce at hogranch.com>

Iulian Badea wrote:
> Hello all,
>
> I have 2 x 250GB sata disks (sda and sdb).
>
> # fdisk -l /dev/sda
>
> Disk /dev/sda: 250.0 GB, 250059350016 bytes
> 255 heads, 63 sectors/track, 30401 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
>
>    Device Boot      Start         End      Blocks   Id  System
> /dev/sda1   *           1       14939   119997486   fd  Linux raid
> autodetect
> /dev/sda2           14940       29878   119997517+  fd  Linux raid
> autodetect
> /dev/sda3           29879       30400     4192965   fd  Linux raid
> autodetect
>
> # fdisk -l /dev/sdb
>
> Disk /dev/sdb: 250.0 GB, 250059350016 bytes
> 255 heads, 63 sectors/track, 30401 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
>
>    Device Boot      Start         End      Blocks   Id  System
> /dev/sdb1   *           1         522     4192933+  fd  Linux raid
> autodetect
>
> # cat /proc/mdstat
> Personalities : [raid1]
> md2 : active raid1 sdb1[1] sda3[0]
>       4192832 blocks [2/2] [UU]
>
> md1 : active raid1 sda2[1] sda1[0]
>       119997376 blocks [2/2] [UU]
>
> What I want to do:
> - have on each disk 2 partitions (4gb for swap and the 200gb+ the rest for
> /)
> - raid 1 between them
>
> This is what I wanted in the beginning, but...I didn't paid attention...
>
> What can I do to rebuild it to my needs (without loosing data or
> reformatting)?
>   

ouch.

I'd boot a rescue CD, drop the mirrors, repartition and mkfs on sdb1, 
dump both file systems to it, drop both metadisks, repartition sda1 as 2 
x raid1 w/o any active mirrors, mkfs on them, restore the dumps to these 
new md0, md1, then repartition sdb again as the two mirrors and join 
them to md0, md1

but thats just me.  others might do it differently.