# root on lvm - initrd doesn't see vg

## funkyFlash

Please move this thread if applicable.

So, I followed the steps at http://en.gentoo-wiki.com/wiki/Root_filesystem_over_LVM2,_DM-Crypt_and_RAID and only used the parts for LVM.  It boots the initrd, and it sees my sda2 (which is the only pv in the vg), but it doesn't see/initialize the vg.

My kernel config is here: http://pastebin.com/gZWQ35BU

My init looks like dis:

```
#!/bin/sh

mount -t proc proc /proc

CMDLINE=`cat /proc/cmdline`

mount -t sysfs sysfs /sys

#wait a little to avoid trailing kernel output

sleep 3

#If you don't have a qwerty keyboard, uncomment the next line 

#loadkmap < /etc/kmap-fr

#raid

#/bin/mdadm --assemble /dev/md2 /dev/sda2 /dev/sdb2

#dm-crypt

#/bin/cryptsetup luksOpen /dev/md2 vault

#lvm

/bin/vgscan --mknodes --ignorelockingfailure -vvv

/bin/vgchange -ay -vvv vg0

#root filesystem

mount -r /dev/mapper/vg0-root /newroot

#unmount pseudo FS

umount /sys

umount /proc

#root switch

exec switch_root /newroot /sbin/init ${CMDLINE}
```

I has dese files:

```
/mnt/gentoo/initram

/mnt/gentoo/initram/newroot

/mnt/gentoo/initram/etc

/mnt/gentoo/initram/proc

/mnt/gentoo/initram/sys

/mnt/gentoo/initram/bin

/mnt/gentoo/initram/bin/switch_root

/mnt/gentoo/initram/bin/vgscan

/mnt/gentoo/initram/bin/vgchange

/mnt/gentoo/initram/bin/busybox

/mnt/gentoo/initram/bin/umount

/mnt/gentoo/initram/bin/cat

/mnt/gentoo/initram/bin/sleep

/mnt/gentoo/initram/bin/sh

/mnt/gentoo/initram/bin/mount

/mnt/gentoo/initram/bin/lvm

/mnt/gentoo/initram/init

/mnt/gentoo/initram/dev

/mnt/gentoo/initram/dev/urandom

/mnt/gentoo/initram/dev/vc

/mnt/gentoo/initram/dev/vc/0

/mnt/gentoo/initram/dev/mapper

/mnt/gentoo/initram/dev/mapper/vg0-swap

/mnt/gentoo/initram/dev/mapper/vg0-root

/mnt/gentoo/initram/dev/mapper/vg0-usrport

/mnt/gentoo/initram/dev/console

/mnt/gentoo/initram/dev/sda2

/mnt/gentoo/initram/dev/null
```

As you can see in my init, i cranked up the vgscan verbosity.  I'll type out what my boot spews, please excuse my typo fail.

```
...

Using volume group(s) on command line

Finding volume group "vg0"

Locking <junk>

/dev/console: Not a block device

/dev/mapper/control: Not a block device

/dev/null: Not a block device

/dev/sda2: Added to device cache

/dev/urandom: Not a block device

/dev/vc/0: Not a block device

/dev/sda2: Skipping (sysfs) ***!!?!?!***

devices/filter not found in config file: no regex filter installed

devices/ignore_suspended)devices not found in config: defaulting to 1

devices/write_cache_state not found in config: defaulting to 1

/dev/sda2: Skipping (sysfs)

Volume group "vg0" not found

<more locking unlocking>

mount: mounting /dev/mapper/vg0-root on /newroot failed: No such file or directory

```

Then busybox whines

Please let me know if there's more info i can provide.

Thanks in advance!

----------

## frostschutz

For custom initramfs, try this guide instead: http://en.gentoo-wiki.com/wiki/Initramfs

I think your hard disk is not detected; you created the device node in your initramfs structure, however according to the vgchange output, it skips the device, suggesting that it's not actually there.

Your kernel config says BLK_DEV_SD (which is required for /dev/sdX devices) is a module, so unless you are loading this module in your initramfs somehow, that'd be your issue. You need to make everything the kernel needs to see the device that holds the root partition, as built-in, not as module, unless you include those modules in the initramfs itself and load them there (however doing this makes the initramfs unnecessarily complex).

----------

## funkyFlash

<3

You rock face.  Thanks for taking the time to look into it.

----------

