Here are some sources that were used for compiling this howto:
http://www.tolaris.com/2008/10/01/moving-your-linux-root-partition-to-raid/http://frankgroeneveld.nl/2009/09/19/howto-live-migrate-to-software-raid-1/http://www.howtoforge.com/software-raid1-grub-boot-debian-etchThe following recipe is ment for converting single hdd (no hw raid) OpenNode installation later into softraid (RAID1) setup - without actually interrupting server operations - eg doing a online conversion.
# Partition scheme on sdb
# /dev/sdb1 - 1024MB
# /dev/sdb2 - rest of disk
# set types to RAID autodetect - fd
# set boot flag on /dev/sdb1
fdisk /dev/sdb
n,p,1,enter,+1024M
n,p,2,enter,enter
t,1,fd
t,2,fd
a,1
p
w
#refresh kernel partition table
partprobe /dev/sdb
#zero superblocks
mdadm --zero-superblock /dev/sdb1
mdadm --zero-superblock /dev/sdb2
#create raid devices
mdadm --create /dev/md0 --level 1 --metadata=0.90 --raid-devices=2 missing /dev/sdb1
mdadm --create /dev/md1 --level 1 --raid-devices=2 missing /dev/sdb2
#format boot device
mkfs.ext3 /dev/md0
#copy data from boot part
mount /dev/md0 /mnt/
rsync -av /boot/* /mnt/
rsync -av /boot/.vm* /mnt/
umount /mnt
#mount new boot part
umount /boot
mount /dev/md0 /boot
#move LVM data
pvcreate /dev/md1
vgextend VolGroupL0 /dev/md1
pvmove /dev/sda2 /dev/md1
vgreduce VolGroupL0 /dev/sda2
pvremove /dev/sda2
#recreate sda partitions
sfdisk -d /dev/sdb | sfdisk /dev/sda
#add sda partitions to RAID
mdadm /dev/md0 --add /dev/sda1
mdadm /dev/md1 --add /dev/sda2
#create mdadm.conf
cp /etc/mdadm.conf /etc/mdadm.conf_orig
mdadm --examine --scan >> /etc/mdadm.conf
#update grub and initrd
#Edit /boot/grub/device.map
nano -w /boot/grub/device.map
--- MODIFY ---
(hd0) /dev/sda
(hd1) /dev/sdb
--- MODIFY ---
#get MD1 array UUID
cat /etc/mdadm.conf | grep md1
cat /etc/mdadm.conf | grep md/1
#update grub conf
nano -w /boot/grub/grub.conf
#remove rd_NO_MD option from kernel boot options
#add rd_MD_UUID=$UUID to kernel boot options
#example:
#kernel /vmlinuz-2.6.32-042stab053.5 ro root=/dev/mapper/VolGroupL0-root rd_LVM_LV=VolGroupL0/root rd_MD_UUID=1c95d02a:15fa85c9:6f10d779:265c3e45 rd_LVM_LV=VolGroupL0/swap rd_NO_LUKS rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet
grub-install /dev/sda
grub-install /dev/sdb
#get the boot filesystem UUID
tune2fs -l /dev/md0 | grep UUID
#replace boot part UUID
nano -w /etc/fstab