[CentOS] Reassemble software RAID

Tue Dec 2 18:31:19 UTC 2008
Kai Schaetzl <maillists at conactive.com>

Scott Silva wrote on Sat, 29 Nov 2008 14:52:18 -0800:

> Before you do anything, can you access the LVM's on /dev/sdb2?
> If so, make sure you back everything up as you will probably need to start
> over on the raid arrays. Worse case you will need a third drive for temporary
> storage. Best case, you can create new arrays on /dev/sda with only one
> member, migrate the data from sdb to sda, and then add sdb to the arrays.

Thanks, I overlooked this message some days ago. I didn't need to back anything 
up. I created the new RAID structure on disk 1 with missing mirrors and kept 
the old structure on disk 2 that was now merely acting like normal 
partitions/LVM. The hard part then was getting it to boot from the RAID. I 
didn't know that the root device path is hardcoded in initrd and an error 
message of "cannot switch to root" is not very helpful (now, a helpful error 
message would have been just slightly different: "cannot switch to root path 
/dev/md1"). I found that out when I finally unpacked the initrd. Once I knew 
that getting it to boot was easy.
Then I moved all data to the new LVM/RAID partition on disk 1 and finally 
copied the partition table to disk 2 and added the missing mirrors to the md 
devices. It took actually a bit more copying to and fro as I experimented a bit 
here and there (like what happens if you dd over a complete PV to an existing 
md device or vice versa or if you can keep the data if you create an md device 
on a partition that already holds data), but I was able to keep all the data 
and system during this.

Kai

-- 
Kai Schätzl, Berlin, Germany
Get your web at Conactive Internet Services: http://www.conactive.com