PDA

View Full Version : [ubuntu] [10.04] mdadm.conf & initrd



nono240
July 5th, 2010, 03:27 PM
Having issues on a fresh 10.04 install: on boot I felt into the initramfs shell saying the (RAID5) root mount point is not found.

After hours of research, I found that the mdadm.conf from initrd was guilty : I had to run a liveCD to extract and modify my initramfs, forcing /dev/sd[abc]x instead of the UUID style for the array detection into mdadm.conf. Automatic array assembly by superblock's UUID doesn't seem to work on initramfs, despite correct UUIDs (double checked): the same mdadm.conf is successfully mounting my arrays under LiveCD (sudo mdadm --assemble --scan).


The caveats is that I have to do it each time my initrd is updated ! Any ideas on how to fix this permanently ?

dino99
July 5th, 2010, 04:38 PM
there are lot of raid issues around, and os-probe is not fixed yet

nono240
July 5th, 2010, 05:44 PM
there are lot of raid issues around, and os-probe is not fixed yet

Maybe. But how to force initramfs tools to put MY settings instead ?

plwrenn
July 7th, 2010, 03:03 PM
I found that the mdadm.conf from initrd was guilty : I had to run a liveCD to extract and modify my initramfs, forcing /dev/sd[abc]x instead of the UUID style for the array detection into mdadm.conf. Automatic array assembly by superblock's UUID doesn't seem to work on initramfs, despite correct UUIDs (double checked): the same mdadm.conf is successfully mounting my arrays under LiveCD (sudo mdadm --assemble --scan).


I am experiencing the exact same problem. My RAID volumes assemble just fine in Rescue mode off the install CD, but initramfs can't seem to accomplish the task.

Would you mind explaining your solution in a little more depth?

Thanks,

nono240
July 7th, 2010, 03:10 PM
Would you mind explaining your solution in a little more depth?


1- Run your LiveCD
2- Mount your /boot partition if any
3- Extract your initrd to a temporary folder
4- Edit your etc/mdadm.conf to not use UUID but device name instead:

Find and replace :
ARRAY /dev/md1 UUID=xxxxxx:xxxxxx:xxxxxxx:xxxxxxx
by
ARRAY /dev/md1 /dev/sd[abc]1

5- Repack your initrd.

It works for me.

plwrenn
July 7th, 2010, 03:39 PM
Yeah, that works for me too!

Which project do you think I should file a bug report with? initramfs-tools or mdadm

Doing that every time a kernel update drops will get old quickly.

nono240
July 7th, 2010, 04:00 PM
Yeah, that works for me too!

Which project do you think I should file a bug report with? initramfs-tools or mdadm

Doing that every time a kernel update drops will get old quickly.


Not sure about the guilty, maybe none of both since UUID style array detection is working once booted. So it's maybe a missing module into initramfs. What do you think ?

plwrenn
July 8th, 2010, 04:43 PM
So it's maybe a missing module into initramfs. What do you think ?

Maybe so, but I really don't know either.

I copied the edited mdadm.conf from the initrd image to /etc/mdadm/mdadm.conf. That's the file that the mdadm hook in initramfs-tools pulls when building the initrd for a new kernel.

That should prevent us from having to repack the initrd after each kernel upgrade.

dschuett
September 1st, 2010, 10:05 PM
Hey guys,

I know this thread is getting to be months old, but I thought I would share my tutorial with you. I have spend DAYS trying to get this configured correctly. I still have flickers of problems with mdadm on 10.04. Every once in awhile when I reboot I will get a waiting for disk press s to skip. OR, like you said I will get dropped into initramfs. It is rare that it even happens, and i'm not sure what actually causes it. And if I do a hard reboot, it boots up just fine. Here is what I have found to be the most successfull:

(starting with two drives that i will be raiding together for storage):

****THIS WILL DESTROY EVERYTHING ON THE DISKS:****

Drive one:
fdisk /dev/sdb
d to delete any partitions
w to write changes
fdisk /dev/sdb
d to make sure no more partitions exist
n for new partition
p for primary
1 for partition number 1
defaults the rest of the way
t to add flag
fd to add raid flag
w to write changes

format partition:
mkfs.ext4 /dev/sdb1

Drive 2:
Repeat all the above steps for /dev/sdc

<---Create RAID Using mdadm--->

mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sdb1 /dev/sdc1

it will show a warning and ask if you want to continue to create the array? y

cat /proc/mdstat

to make sure array is done being created.

mkfs.ext4 /dev/md0

wait for it to complete

mdadm --auto-detect

to detect array

mdadm --detail --scan


The output will look something like this (depending on your arrays):
mdadm: md device /dev/md/d0 does not appear to be active.
ARRAY /dev/md0 level=raid1 num-devices=2 metadata=00.90 UUID=02a3fb05:e090a494:1b1a320b:21b9bdd9

copy the "ARRAY" line above to mdadm.conf right under # definitions of existing MD arrays (remove "metadata=00.90" from the line though).
ARRAY /dev/md0 level=raid1 num-devices=2 UUID=02a3fb05:e090a494:1b1a320b:21b9bdd9

now get the UUID of your array from BLKID and add it to fstab as such:
UUID=bcceef2f-fad8-41bc-893d-f29b65a2cf0f /YourMountPoint ext4 defaults 0 0

# mount -a

Hope this helps someone, and if anyone figures out if i am missing something that is causing to drop to initramfs or waiting for disk errors every once in awhile on boot, please share!