What tells initramfs or the Ubuntu Server boot process how to assemble RAID arrays?

Well looking at the scripts used to assemble the initramfs, I'm thinking the problem is probably just that your /etc/mdadm/mdadm.conf is out of date.

When your system's up with the arrays assemble, execute the following command to update your mdadm config. You may want to double check it just in case as well.

mdadm --detail --scan > /etc/mdadm/mdadm.conf

Once done, update your initramfs with :

update-initramfs

If this consistently fails, then your superblocks ( the metadata used to assemble the arrays ) may be shot. You may want to examine each of your drives and their partitions to verify. Worse case, zero out out superblocks via mdadm and recreate.


It sounds like your initramfs was created when your RAID setup was wrong (or just different to now) and hasn't been updated since.

You could run update-initramfs (which is normally run after kernel updates) and hopefully this will rebuild your initramfs file, including building in the right raid configuration files.


Here's a workaround I came up with:

Add this script to /etc/initramfs-tools/scripts/local-top:

 #!/bin/sh
 sleep 6
 mdadm --stop /dev/md1
 mdadm --stop /dev/md0
 sleep 6
 mdadm --assemble --scan

This fixes the RAID arrays before the system tries to mount md1 to /root. I had to add the pauses in in order to get the commands to work consistently.

This doesn't actually fix the problem, but it's the best solution I've found that doesn't require changing the RAID arrays or upgrading software.


I have the same problem, and found this link that explains why it happens: https://bugs.launchpad.net/ubuntu/+source/debian-installer/+bug/599515 seems that your sda2 partition goes all the way to the end of the disk and overwrites the disk superblock, so that sda and sda2 are the same thing to mdadm and it ends up assembling md1 with sda instead of sda2