PBX Platforms - How to Setup Software Raid after the fact

PBX Platforms - How to Setup Software Raid after the fact

If you ever need to setup Software Raid on a box after you have already installed your Distro you can following the steps below.

 

  1. mdadm will ask which MD arrays are needed for the root fs. Go with the default (all)

yum install mdadm initramfs-tools vim
  1. Add raid1 to /etc/modules

echo "raid1" >> /etc/modules
  1. Regenerate initrd.img file

mkinitramfs -o /boot/test -r /dev/mapper/pve-root
  1. Rename old img file (replace .x for whatever kernel version you are using)

mv /boot/initrd.img-2.6.18-2-pve /boot/initrd.img-2.6.18-2-pve.original
  1. Rename new img file

mv /boot/test /boot/initrd.img-2.6.18-2-pve
  1. Make sure grub is setup on both hdds

grub-install --no-floppy /dev/sda grub-install --no-floppy /dev/sdb
  1. Change UUID for (hd0,0) on /boot/grub/menu.1st if your file has the UUID in it. This most likely involves replacing the root UUID=XXXXX line with root hd(0,0)

# nano /boot/grub/menu.1st
  1. Change UUIDs for proper md0 devices on /etc/fstab if your file has the UUID in it.

  2. Now do the same thing for the /etc/fstab file.

  3. Replace the UUID=XXXXXXXXX /boot ext3 defaults 0 1 line with /dev/md0 /boot ext3 defaults 0

# nano /etc/fstab
  1. Clone the partition table from 1st drive to 2nd

sfdisk -d /dev/sda | sfdisk --force /dev/sdb
  1. Create md devices with second drive only

mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sdb1 mdadm --create /dev/md1 --level=1 --raid-devices=2 missing /dev/sdb2
  1. Save new mdconf file

mdadm --detail --scan >> /etc/mdadm/mdadm.conf
  1. Get boot device setup

mkfs.ext3 /dev/md0 mkdir /mnt/md0 mount /dev/md0 /mnt/md0 cp -ax /boot/* /mnt/md0 umount /mnt/md0 umount /boot; mount /dev/md0 /boot sfdisk --change-id /dev/sda 1 fd mdadm --add /dev/md0 /dev/sda1
  1. Setup data device

pvcreate /dev/md1 vgextend pve /dev/md1
  1. This step takes a LOOOOONG time

pvmove /dev/sda2 /dev/md1 vgreduce pve /dev/sda2 sfdisk --change-id /dev/sda 2 fd mdadm --add /dev/md1 /dev/sda2

 

Unable to render {include} The included page could not be found.