Google

Using lvm only on specific drives (Reading all physical volumes. This may take a while…)

On our kvm hypervisor we have several vm’s using fibre channel for storage. The hypervisor has to see all the devices, but each device has it’s own lvm so when the hypervisor boots, it tries to read all of them.

To fix this i restricted lvm to only use sda (documented in lvm.conf). If you are stuck at the vgscan stage
Reading all physical volumes. This may take a while…
Then you probably need to do something similar to this.
devices {
    dir = "/dev"
    scan = [ "/dev" ]
    preferred_names = [ ]
    filter = [ "a|/dev/sda.*|", "r|.*|" ]
}
The filter line is the important one. After that you’ll need to rebuild initrd to pickup the modified lvm.conf. I usually cheat and use the kernel’s method for that.
[root@server0 lvm]# rpm -q kernel --scripts |grep mkinitrd
/sbin/new-kernel-pkg --package kernel --mkinitrd --depmod --install 2.6.18-128.1.16.el5 || exit $?
[root@server0 lvm]#
Hope that helps.

2 Responses to “Using lvm only on specific drives (Reading all physical volumes. This may take a while…)”

  1. Alex Says:

    Hi!

    I am using Debian … it looks like the vgscan is issued in /etc/init.d/lvm2. Do you have any idea if I also have to update the initramfs?

    Alex

  2. uphill Says:

    Our systems are RedHat/Fedora/Centos based, the vgscan is issued from the initrd on our distro, so it should be in the initramfs on yours. This is because the system needs to do the vgscan to find the lvm’s and mount ‘/’ before it can read ‘/etc/init.d/lvm2′. On our system the /etc/lvm/lvm.conf is picked up by the call to mkinitrd, I assume something similar will happen on debian (I don’t know much about debian, sorry), maybe check how the system updates itself after a kernel upgrade.

Leave a Reply