4

I have Ubuntu 12.10 (no updates, kernel 3.5.0-17-generic) on first HDD (sda), which uses MBR and was partitioned as "Use whole disk for ubuntu" with LVM2 enabled. Root filesystem is on LVM2 (VG:ubuntu). Today I added second HDD (sdb) with same size, partitioned it like first hdd, created lvm2 PV and converted root LV to raid1:

pvcreate /dev/sdb5
vgextend ubuntu /dev/sdb5
lvconvert --type raid1 -m1 /dev/ubuntu/root /dev/sdb5

After 100% resync I rebooted and initramfs was unable to find root fs:

Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
... (kernel messages)
Gave up waiting for root device. Common problems:
 - Boot args (cat /proc/cmdline)
   - Check rootdelay= (did the system wait long enough?)
   - Check root= (did the system wait for the right device?)
 - Missing modules (cat /proc/modules; ls /dev)
ALERT!  /dev/mapper/ubuntu-root does not exist.  
Dropping to a shell!

There is list of modules:

(initramfs) cat /proc/modules
hid_generic
usbhid
hid
e1000
raid10
raid456
async_pq
async_xor
xor
async_memcpy
async_raid6_recov
raid6_pq
async_tx
raid1
raid0
multipath
linear
(initramfs) cat /proc/cmdline
BOOT_IMAGE=/vmlinux-3.5.0-17-generic root=/dev/mapper/ubuntu-root ro
(initramfs) ls /dev/mapper
control     ubuntu-swap_1

There is output from lvm utility:

lvm> pvscan
  PV /dev/sda5    VG ubuntu   lvm2 [ 13.76 GiB / 408.00 MiB free]
  PV /dev/sdb5    VG ubuntu   lvm2 [ 13.76 GiB / 508.00 MiB free]
lvm> vgscan
  Reading all physical volumes. This may take a while...
  Found volume group "ubuntu" using metadata type lvm2
lvm> lvscan
  inactive        '/dev/ubuntu/root' [13.26 GiB] inherit
  ACTIVE          '/dev/ubuntu/swap_1' [100.00 MiB] inherit

lvm> lvdisplay ubuntu
  --- Logical volume ---
  LV Path                /dev/ubuntu/root
  LV Name                root
  VG Name                ubuntu
  LV UUID                xxxxxxxxxxxxxxx
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2013-05-07
  LV Status              NOT available          <<<<< !!!!
  LV Size                13.26 GB
  Current LE             3394
  Mirrored volumes       2
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto

And lvchange -ay ubuntu fails:

lvm>  lvchange -ay ubuntu
  /sbin/modprobe failed: 1
  Can't process LV root: raid1 target support missing from kernel?

What is missing from initrd?

2 Answers 2

7

I hit this same problem on my Debian system; it turned to be caused by some necessary modules not getting installed in the initramfs.

Specifically, after adding these lines to /etc/initramfs-tools/modules:

dm_mirror
dm_raid
dm_region_hash

and running

update-initramfs -u -k all

my system boots correctly.

Note that I have not checked that all of these lines are actually necessary. I think the dm_raid module is missing by default at least.

After further searching, there is a Debian bug open against initramfs-tools over this issue: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699804

3
  • 1
    Adding just the dm_raid and raid1 modules worked for me.
    – Gary
    Aug 16, 2013 at 5:38
  • Apparently, from what I read, if you created your LVM mirror a while back (mine is really old, nearly 10 years...) then trying to use RAID1 just won't work. I tried many things and since I wanted to keep my /home partition, I couldn't try to start 100% from scratch. Jan 21, 2020 at 5:06
  • A quick way to fix this is to install the mdadm package which installs the needed raid modules via /usr/share/initramfs-tools/hooks/mdadm In Debian buster for example the raid1 module is missing see bugs.debian.org/cgi-bin/bugreport.cgi?bug=841423
    – jtaylor
    Jul 8, 2020 at 17:39
1

Another option is to use the mirror type instead of the raid1. That should work by default, even grub2 supports it. So instead of

lvconvert --type raid1 -m1 /dev/ubuntu/root /dev/sdb5

do this:

lvconvert --type mirror -m1 /dev/ubuntu/root /dev/sdb5

(You don't need to specify sdb5 at the end, LVM will choose a suitable PV to put the mirror on.)

The mirror type has a big drawback though, it only reads from the first device, so you won't get the read performance speedup expected from RAID1.

3
  • Tobias, thank you. Where can I read about difference between lvm raid1 and mirror?
    – osgx
    Jan 4, 2016 at 18:35
  • 1
    I don't know where this might be documented, I figured these things out myself empirically. (For example you can watch iostat while reading from a mirror lvm and see that only one PV is busy reading.) Jan 8, 2016 at 9:02
  • The fact is that you still can't boot on a RAID1, which is why changing the type of mirror is the easiest solution to fix the problem. It's a "work around". Jan 20, 2020 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.