Install ubuntu desktop on software raid

Being a bit naive about raid systems, i had to look up a bit at how to reinstall my ubuntu system on a raid1 on my two new SSDs.

Googling reveal much confusion and not very up to date information, so i ended up learning a bit about mdadm and the installer.

So here are the simple^W steps i followed.

  1. boot on your live cd/usb, chose "try ubuntu without installing"

  2. when booted up, fire a terminal, and install mdadm

    sudo apt-get install mdadm
    
  3. if you already have your raid devices created, assemble them

    sudo mdadm --assemble /dev/md0
    

    (repeat and adjust for each device)

    If you, as me, though it was a good idea to have a swap raid device (raid0 :3), be sure to swapoff the two partitions before trying to assemble the device, for me it was:

    sudo swapoff /dev/sda2
    sudo swapoff /dev/sdb2
    sudo mdadm --assemble /dev/md1
    
  4. if you need to create the devices, use mdadm too

    sudo mdadm --create --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
    

    (repeat and adjust for each device, level 1 is mirroring)

  5. start the installer, at the partition step, select "do something else" and be careful that no partition used by a device is directly mounted (including swap ones, that are automatically mounted, use "no dot use this partition" on them, they should be switch type from "swap" to "linux-swap").

  6. select your mdXpY and other partitions just like you would use /dev/sdXY partitions.

  7. don't forget to select the correct boot device (grub install).

    Install should happen cleanly.

  8. After the install is complete, you still need to make your system, able to work with raid, as mdadm is not installed by default, it won't boot currently, so when the install is complete, select "continue testing", then chroot to the installed system.

    cd /media/ubuntu/*/
    sudo mount -o bind /proc proc
    sudo mount -o bind /sys sys
    sudo mount -o bind /dev dev
    sudo chroot .
    sudo apt-get install mdadm
    

    if you have issues with network, try to copy /etc/resolv.conf from the host system

    sudo cp /etc/resolv.conf etc/
    
  9. Still in the chroot, reinstall and update grub

    sudo grub-install /dev/sda
    sudo update-grub
    
  10. You can now leave the chroot and reboot to your new system.

    exit
    sudo reboot
    

And voilĂ ! You should have a bootable software-raid ubuntu desktop install.

Now, really, this should be much simpler, i really don't see any reason that the desktop install image doesn't have the raid configuration options in the partition choices, and is not aware enought to fix all these little annoyances.