caveats:
- centos 6.5 seems to come with grub 0.97 by default, so new-format mdadm raid
  is not supported for the /boot partition
- centos puts "rd_NO_MD" in the kernel boot line, which inhibits loading raid
  drivers
- centos likes to kernel panic during boot. this is not as bad a thing as it
  would be in other distros; it usually just means it can't find the root
  filesystem.


Overview:

At the start, the assumption is that you have two disks:
original disk: contains your current install in a plain, non-raided configuration
new disk: is blank

We will get this to an intermediate stage:
original disk: unmodified current install
new disk: RAIDed version of current install (degraded to one disk)

Then, pull the original disk completely out of the system and try to boot from
the RAIDed one alone. If it works, put the original disk back in, wipe it, and
make it the other mirror of the RAID sets.



steps:


make a backup of /boot and /etc.


Partition your new disk, create raid partitions (make sure to use old style
metadata for the /boot array), make filesystems, copy current system contents
onto them. Verify the copies.


in /etc and the new /etc, create mdadm.conf:
mdadm --detail --scan > mdadm.conf
edit the file as necessary (e.g. in case you have some other arrays you don't
want in there)


On the new root filesystem, edit etc/fstab to point to the new raid partitions
(note: if you use UUIDs be sure to use the ones for the filesystem and not the
RAID set. that is, if your new root filesystem is /dev/md125, you might have:

$ ls -l /dev/disk/by-uuid/
2c6f9bfa-a525-4999-b23f-277d4840e5a7 -> ../../md125

$ cat /etc/mdadm.conf
ARRAY /dev/md/root metadata=1.2 name=hostname:root UUID=8faa93b0:03532d88:4829144d:891d43e7

make sure you use the one from by-uuid, NOT the mdadm.conf one.)


make a backup of /boot and /etc from the current disk.


put your new /etc/fstab and /etc/mdadm.conf into the current /etc.


unmount the current /boot and mount the new RAID /boot in its place.


update the boot image to include the mdadm.conf info:
$ dracut --mdadmconf /boot/initramfs-$(uname -r) $(uname -r)


edit /boot/grub/grub.conf (which is actually menu.lst as this is old grub):
- remove rd_NO_MD and "rhgb quiet" from the kernel line
- update the root device UUID or path


now install grub to the new disk (note: be very sure that the 'hd' numbers are
right, since you don't want to clobber your current disk):

$ grub
grub> root (hd1,0)
grub> setup (hd1)
grub> quit


now restore /etc/fstab to the current version (since we're still running under
the old system), unmount /boot, and shut down.


Pull the current disk, and attempt to boot with only the RAIDed disk inserted.
If everything works, wipe the old disk and extend the RAID onto it. If not,
debug.