You are not logged in.

#1 2009-02-15 00:31:11

Odysseus
Member
Registered: 2009-02-15
Posts: 141

Problems with RAID and a Flash USB Drive

I'm attempting to install on a RAID 1 array using just one usb flash drive.  Yes, just one.  I'm trying out the idea's in this thread: http://bbs.archlinux.org/viewtopic.php?id=64281
Partitioning scheme:

sdb1 -> boot partition
sdb2 -> swap
sdb3 -> raid 1 array -> root

I set the partitiions to type 0xfd (linux raid autodetect) in fdisk (probably not necessary) and created the array with:

mdadm -C /dev/md0 -n 2 -l -b internal missing -W --write-behind /dev/sdb3

I then installed like normal, specifying that I needed usb and raid hooks in mkinitcpio.conf

I added "md=0,/dev/sdb3" as a kernel option in grub's menu.lst, specifying that the md driver should assemble /dev/md0 (my root partition) out of /dev/sdb3 before trying to mount it.

This process was succesful using a partition on my hard drive.

However, using a usb drive causes a kernel panic during boot when trying to mount /dev/md0.
Looking at the messages reveals that before my usb drive was detected, md attempted to create the array, unsuccessfully, as /dev/sdb didn't exist yet.  "md: unkown device name /dev/sdb3" or something to that effect.

In mkinitcpio.conf, the usb hook comes before the raid hook, so this shouldn't be happening, should it?


I'm the type to fling myself headlong through the magical wardrobe, and then incinerate the ornate mahogany portal behind me with a Molotov cocktail.

Offline

#2 2009-02-15 13:25:06

apaige
Member
Registered: 2008-06-15
Posts: 96

Re: Problems with RAID and a Flash USB Drive

Try adding rootdelay=15 to your kernel command line.

Offline

#3 2009-02-15 17:07:44

nowahn
Member
From: elsewhere
Registered: 2008-12-05
Posts: 75

Re: Problems with RAID and a Flash USB Drive

I think rootdelay will not work in that special case, rootdelay makes the system to wait after all the hooks are executed, and you need to wait before executing the raid hook.
I don't know if there is an easy way for that, but one solution is to modify the raid hook to wait for /dev/sdb3 to be created :
- edit /lib/initcpio/hooks/raid, add this before the /bin/mdassemble command :

until [ -e /dev/sdb3 ] ;
do
   sleep 1 ;
done

- rebuild your boot images with mkinitcpio (you'll need to chroot to your system)
that should work

PS: someone correct me if I'm wrong, but from what I know, the usb hook does not create your /dev/sdb (if you edit the usb hook, you'll see that it only set rootdelay if it is not yet set). it is the udev daemon, which is launched in the background by the udev hook, and the udev daemon is quite long to create USB device nodes.


take time to daydream, inspiration comes ...

Offline

#4 2009-02-15 19:28:01

Odysseus
Member
Registered: 2009-02-15
Posts: 141

Re: Problems with RAID and a Flash USB Drive

Thanks nowhan, worked like a charm.  Would this be something worth putting on the bug tracker?


I'm the type to fling myself headlong through the magical wardrobe, and then incinerate the ornate mahogany portal behind me with a Molotov cocktail.

Offline

#5 2009-02-15 21:56:48

nowahn
Member
From: elsewhere
Registered: 2008-12-05
Posts: 75

Re: Problems with RAID and a Flash USB Drive

well, I think this would be worth, but I think it is a bug of the usb hook. in fact, I think it would be more logical to add the lines above in the usb hook instead of the raid hook.


take time to daydream, inspiration comes ...

Offline

#6 2009-02-15 22:10:42

nowahn
Member
From: elsewhere
Registered: 2008-12-05
Posts: 75

Re: Problems with RAID and a Flash USB Drive

well, I have found this bug report which is the same problem (even if it is about USB and encrypted partition). I think you should post to this bug with our solution (I can do it if you like, but it is your bug wink )


take time to daydream, inspiration comes ...

Offline

#7 2009-02-15 22:15:55

Odysseus
Member
Registered: 2009-02-15
Posts: 141

Re: Problems with RAID and a Flash USB Drive

nowahn wrote:

well, I think this would be worth, but I think it is a bug of the usb hook. in fact, I think it would be more logical to add the lines above in the usb hook instead of the raid hook.

Yea, I was kinda wondering that.  I'll post a comment there.


I'm the type to fling myself headlong through the magical wardrobe, and then incinerate the ornate mahogany portal behind me with a Molotov cocktail.

Offline

Board footer

Powered by FluxBB