You are not logged in.

#1 2012-10-20 10:33:34

Tom Fyuri
Member
Registered: 2011-04-22
Posts: 5

mdadm_udev can't assemble root partition? (mdadm inside lvm)

$ grep ^MODULES= /etc/mkinitcpio.conf
MODULES="dm_mod raid0 raid1 ext4 btrfs"
not sure, if i even need any of modules apart from dm_mod.
$ grep ^HOOKS= /etc/mkinitcpio.conf
HOOKS="base udev autodetect pata scsi sata lvm2 mdadm_udev mdadm_root filesystems usbinput fsck btrfs"
mdadm_root is my custom hook, more about it bit later.

I have 2 volume groups: vg0, vg1 (lvm). And I have few partitions raid1 like /dev/vg[01]/root /dev/vg[01]/var and so on.
The problem is after booting i get rootfs console and it asks for my help. I believe the only thing it fails to do is to assemble root. (though /dev/md folder doesn't even exist)
So i run:
mdadm --incremental --run /dev/vg0/root; mdadm --incremental --run /dev/vg1/root
And allow it to finish booting and everything works.
Hence I created custom hook:
$ cat /usr/lib/initcpio/hooks/mdadm_root

run_hook ()
{
    bash -c "mdadm --incremental --run /dev/vg0/root; mdadm --incremental --run /dev/vg1/root"
}

edit: $ cat /usr/lib/initcpio/install/mdadm_root

#!/bin/bash

build() {
    add_binary /bin/bash 
    add_runscript 
}

help() {
    cat <<HELPEOF
    Helps boot system by mounting root md properly.
HELPEOF
}

Rebuilt initramfs image and rebooted. It works, it boots fine. I don't need to type anything, everything is mounted. But I don't think I really need to have my custom hook to boot, it's just workaround. big_smile

Note:
$ grep ^[^#].* /etc/mdadm.conf
DEVICE partitions
But it appears mdadm_udev don't even  need anything from /etc/mdadm.conf

Also I use systemd. Grub2. Root, var are ext4 partitions. And grub2 has "set root='mduuid/148dac2cd4de5f66f646030b18d04144'".
Also /boot partition is not inside mdadm raid, but just lvm (/dev/vg0/boot).
$ uname -a
Linux archlinux 3.6.2-1-ck #1 SMP PREEMPT Sat Oct 13 15:22:51 EDT 2012 i686 GNU/Linux
I use latest packages.

What could be the problem? What information I need to post? Is it bug? Maybe it was caused by latest kernel?

Thanks!

edit: Did i miss something or messed up something with mkinitcpio?
Also if i use mdadm instead of mdadm_udev it boots fine without my custom hook, but mounting each raid partition takes about 6-12 seconds, so archlinux boots like 10 times slower.

Last edited by Tom Fyuri (2012-10-20 18:51:53)

Offline

#2 2012-10-20 14:18:52

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: mdadm_udev can't assemble root partition? (mdadm inside lvm)

Tom Fyuri wrote:

Hence I created custom hook:
$ cat /usr/lib/initcpio/hooks/mdadm_root
run_hook ()
{
    bash -c "mdadm --incremental --run /dev/vg0/root; mdadm --incremental --run /dev/vg1/root"
}

I don't even understand how this works, given that bash isn't present on the image. Do you have an /etc/mdadm.conf included in the initramfs?

Offline

#3 2012-10-20 17:16:37

Tom Fyuri
Member
Registered: 2011-04-22
Posts: 5

Re: mdadm_udev can't assemble root partition? (mdadm inside lvm)

falconindy wrote:
Tom Fyuri wrote:

Hence I created custom hook:
$ cat /usr/lib/initcpio/hooks/mdadm_root
run_hook ()
{
    bash -c "mdadm --incremental --run /dev/vg0/root; mdadm --incremental --run /dev/vg1/root"
}

I don't even understand how this works, given that bash isn't present on the image. Do you have an /etc/mdadm.conf included in the initramfs?


$ cat /usr/lib/initcpio/install/mdadm_root

#!/bin/bash

build() {
    add_binary /bin/bash  
    add_runscript  
}

help() {
    cat <<HELPEOF
    Helps boot system by mounting root md properly.
HELPEOF
}

Well it seems it works. And no, initramfs doesn't have /etc/mdadm.conf and if I put all my arrays and include it, the result doesn't change anyway. I thought mdadm_udev purpose was to make it just work without using /etc/mdadm.conf at all, am I wrong? (Just tryed including root array into it and rebooting (rebuilt image obviously including the file), didn't boot me, had to assemble it manually to continue booting)

I'm sorry my explanation is so terrible. hmm I will try booting with different kernel versions bit later. It seems no one else has issues with lvm & raid, so it's probably only me.

Last edited by Tom Fyuri (2012-10-20 18:52:24)

Offline

#4 2012-10-20 17:59:09

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: mdadm_udev can't assemble root partition? (mdadm inside lvm)

Tom Fyuri wrote:
falconindy wrote:
Tom Fyuri wrote:

Hence I created custom hook:
$ cat /usr/lib/initcpio/hooks/mdadm_root
run_hook ()
{
    bash -c "mdadm --incremental --run /dev/vg0/root; mdadm --incremental --run /dev/vg1/root"
}

I don't even understand how this works, given that bash isn't present on the image. Do you have an /etc/mdadm.conf included in the initramfs?


$ cat /usr/lib/initcpio/install/mdadm_root
#!/bin/bash

build() {
    add_binary /bin/bash 
    add_runscript 
}

help() {
    cat <<HELPEOF
    Helps boot system by mounting root md properly.
HELPEOF
}

Please use code tags.

Why would you do this? What's insufficient about the shell included on the initramfs? You're adding several megabytes to the image by including bash for this one line. Your runtime hook is simply:

run_hook() {
  mdadm --incremental --run /dev/vg0/root
  mdadm --incremental --run /dev/vg1/root
}
Tom Fyuri wrote:

Well it seems it works. And no, initramfs doesn't have /etc/mdadm.conf and if I put all my arrays and include it, the result doesn't change anyway. I thought mdadm_udev purpose was to make it just work without using /etc/mdadm.conf at all, am I wrong? (Just tryed including root array into it and rebooting (rebuilt image obviously including the file), didn't boot me, had to assemble it manually to continue booting)

I'm sorry my explanation is so terrible. hmm I will try booting with different kernel versions bit later. It seems no one else has issues with lvm & raid, so it's probably only me.

Yes, you can avoid /etc/mdadm.conf if you use mdadm_udev, but the config file is still added and respected by the mdadm_udev hook in case you want persistent naming (and not kernel names like /dev/md127...).

Offline

#5 2012-10-20 18:58:48

Tom Fyuri
Member
Registered: 2011-04-22
Posts: 5

Re: mdadm_udev can't assemble root partition? (mdadm inside lvm)

falconindy wrote:

Please use code tags.

Why would you do this? What's insufficient about the shell included on the initramfs? You're adding several megabytes to the image by including bash for this one line. Your runtime hook is simply:

run_hook() {
  mdadm --incremental --run /dev/vg0/root
  mdadm --incremental --run /dev/vg1/root
}

Oh yes, you are right. I'm new to custom hooks so it was my first attempt. Thanks for the tip.

falconindy wrote:

Yes, you can avoid /etc/mdadm.conf if you use mdadm_udev, but the config file is still added and respected by the mdadm_udev hook in case you want persistent naming (and not kernel names like /dev/md127...).

My fstab uses:
/dev/md/root / ext4 defaults,noatime 0 1
/dev/mapper/vg0-boot /boot ext2 defaults,noatime 0 1
/dev/md/var /var ext4 defaults,noatime 0 1
and so on entries, though they are just symlinks.
Couldn't get /etc/mdadm.conf to work yet.

edit: tried previous kernel versions, doesn't boot too. Not sure, probably last thing to try is to modify udev md rules.

Last edited by Tom Fyuri (2012-10-20 19:34:12)

Offline

Board footer

Powered by FluxBB