Sunday, 23 August 2015

Linux dropping to shell on initramfs on ubunu 12.04 with mdadm

So my NAS HDD packed up and I haven't puppet-fied or chefy-fied any of the config so a rebuild from scratch is required....

During this rebuild I got an interesting error which basically dumps me to a root shell as initramfs can't build my software raid properly. I have a SSD as /dev/sda and the raid disks on /dev/sd[b-f]

I know this is BS cos I can mount the drives after typing exit on the prompt.
Even after dumping to a prompt (initramfs) typing:
cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10]
md127 : active raid5 sdf1[5] sde1[3] sdc1[1] sdd1[2] sdb1[0]
      15627540480 blocks super 1.2 level 5, 512k chunk, algorithm 2 [5/5] [UUUUU]
     
unused devices: <none>
 
Initially I got this message:
 Which seemed like the drives didn't spin up in time for mdadm to assemble the RAID
I made many changes (grub changes, initramfs changes etc),but the only thing that worked was to change the scripts on initramfs.

When initramfs starts up it pulls in the mdadm.conf from your system and tried to run it. Due to a bug in mdadm, it doesn't assemble the RAID when using the UUID (blkid). This seems to be a bug and there is an issue raised in bugzilla.

Removing mdadm from the system wasn't an option, cos well, you need to assemble the RAID, right?
Other options about changing the mdadm options in initramfs didn't work for me either, nor setting the /etc/initramfs-tools/scripts/local-top/ for a sleep and stopping the array.

The thing that worked for me was  deleting the mdadm file in 
/usr/share/initramfs-tools/scripts/local-premount

then update-initramfs -u -v
 
BAM!
done








No comments:

Post a Comment