proxmox software raid

I have a testing box that didn’t have a hardware raid card in it so I decided to see if I could get this going for grins. I’m fairly certain this whole setup would break at the least desirable moment and I certainly won’t be using this for any production boxes, but it was an interesting diversion into the world of software raid which I’d never used before. The basic order I followed is:

Install Proxmox as usual onto 1 drive(/dev/sda)
aptitude install mdadm initramfs-tools

Edit the modules list for initramfs-tools to force add the raid1 module

mkinitramfs -o /boot/test -r /dev/mapper/pve-root
add a grub list entry to point to my new initrd image

fdisk the 2nd disk to look exactly like the first disk
mdadm –create /dev/md0 –level=1 –raid-devices=2 missing /dev/sdb1
mdadm –create /dev/md1 –level=1 –raid-devices=2 missing /dev/sdb2
mdadm –detail –scan >> /etc/mdadm/mdadm.conf

pvcreate /dev/md1
vgextend pve /dev/md1
pvmove /dev/sda2 /dev/md1
vgreduce pve /dev/sda2

mdadm –add /dev/md1 /dev/sda2
watch -n 1 “cat /proc/mdstat”

mkfs.ext3 /dev/md0
mkdir /mnt/md0
mount /dev/md0 /mnt/md0
cp -ax /boot /mnt/md0

edit fstab to map the /boot to /dev/md0

sfdisk –change-id /dev/sda1 fd
mdadm –add /dev/md0 /dev/sda1

use grub to install bootloader onto the 2nd hard drive