[CentOS] Re: mdadm problem.

Tue Sep 25 16:56:34 UTC 2007
Scott Silva <ssilva at sgvwater.com>

on 9/25/2007 9:44 AM David Mackintosh spake the following:
> So I'm trying to RAID-1 this system which has two identical disks
> installed in it, and it isn't working for some reason.
> 
> I started by doing a CentOS-4 install on /dev/sda1 as root, and with
> /dev/sda2 as my swap.
> 
> I finish the install, yum update, and then I want to make the mirrors.
> 
> I copy the partition table from one disk to the other:
> 
> # sfdisk -d /dev/sda | sfdisk /dev/sdb
> 
> I create my metadevices:
> 
> # mdadm -Cv -l1 -n2 /dev/md1 /dev/sdb1 missing
> # mdadm -Cv -l1 -n2 /dev/md2 /dev/sdb2 missing
> 
> I create my filesystems:
> 
> # mkfs.ext3 /dev/md1
> # mkswap /dev/md2
> 
> I change the /etc/fstab to use /dev/md1 for / and /dev/md2 for swap.
> 
> I change the /etc/grub.conf to use /dev/md1 for the root= parameter on my kernel.
> 
> I build myself a new initrd for the kernel I want to boot.
> 
> I copy the contents of / over to the one-armed mirror:
> 
> # cd /
> # mnt /dev/md1 /mnt/md1
> # tar cfpl - . | ( cd /mnt/md1 ; tar xfp -)
> # umount /mnt/md1
> # sync
> 
> I run grub just in case:
> 
> # grub
>> device (hd0) /dev/sda
>> root (hd0,0)
>> setup (hd0)
> 
> I reboot, expecting that the system will find /dev/md1 and use it as
> its root... but it doesn't.  Digging around in hobbled mode (changing
> the root= parameter in grub to /dev/sda1 instead of /dev/md1) shows
> that /dev/md1 doesn't get assembled, therefore it doesn't get mounted.
> 
> Can anyone tell me what I've done wrong?
The partitions need to be type fd (raid autodetect) to work properly on boot. 
It is much easier to set this up in the initial install.

You can migrate, but it takes a few more steps to be sucessful.
Look at the raid howto, I think it has all the steps to migrate.

-- 

MailScanner is like deodorant...
You hope everybody uses it, and
you notice quickly if they don't!!!!