LVM activation at boot

Hi all,

I used to have an LVM volume created with Yast that appeared in /dev/mapper, which doesn’t show up anymore.

Up until snapshot 20180812 this is what is in the journal (logs in reverse order):


Sep 04 11:11:05 matdesk.home lvm[6661]:   1 logical volume(s) in volume group "dischi" unmonitored
Sep 04 09:22:23 matdesk lvm[762]:   1 logical volume(s) in volume group "dischi" now active
Sep 04 09:22:23 matdesk lvm[758]:   1 logical volume(s) in volume group "dischi" now active
Sep 04 09:22:22 matdesk lvm[988]:   1 logical volume(s) in volume group "dischi" now active
Sep 04 09:22:21 matdesk lvm[597]:   WARNING: Device for PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW not found or rejected by a filter.
Sep 04 09:22:21 matdesk lvm[758]:   WARNING: lvmetad is being updated, retrying (setup) for 10 more seconds.
Sep 04 09:22:21 matdesk lvm[762]:   WARNING: lvmetad is being updated, retrying (setup) for 10 more seconds.

from what I could see everything was working fine. I still don’t understand the message about the device not found, but anyway…

Then I did a distro upgrade from 20180812 to 20180829 and this is what I get now:


Sep 09 16:08:04 matdesk lvm[1010]:   dischi: autoactivation failed.
Sep 09 16:08:04 matdesk lvm[1010]:   0 logical volume(s) in volume group "dischi" now active
Sep 09 16:08:04 matdesk lvm[1010]:   Cannot activate LVs in VG dischi while PVs appear on duplicate devices.
Sep 09 16:08:04 matdesk lvm[1010]:   WARNING: PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW prefers device /dev/sdc1 because of previous p>
Sep 09 16:08:04 matdesk lvm[1010]:   WARNING: Not using device /dev/md127 for PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW.
Sep 09 16:08:04 matdesk lvm[1010]:   WARNING: Not using device /dev/sdd1 for PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW.
Sep 09 16:08:04 matdesk lvm[1010]:   WARNING: Autoactivation reading from disk instead of lvmetad.
Sep 09 16:08:04 matdesk lvm[1010]:   WARNING: Not using lvmetad because cache update failed.
Sep 09 16:08:04 matdesk lvm[1010]:   WARNING: Scan found duplicate PVs.
Sep 09 16:08:04 matdesk lvm[1010]:   WARNING: Disabling lvmetad cache which does not support duplicate PVs.
Sep 09 16:08:04 matdesk lvm[1010]:   WARNING: found device with duplicate /dev/md127
Sep 09 16:08:04 matdesk lvm[1010]:   WARNING: found device with duplicate /dev/sdd1
Sep 09 16:08:04 matdesk lvm[794]:   dischi: autoactivation failed.
Sep 09 16:08:04 matdesk lvm[794]:   0 logical volume(s) in volume group "dischi" now active
Sep 09 16:08:04 matdesk lvm[794]:   Cannot activate LVs in VG dischi while PVs appear on duplicate devices.
Sep 09 16:08:04 matdesk lvm[794]:   WARNING: PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW prefers device /dev/sdc1 because of previous pr>
Sep 09 16:08:04 matdesk lvm[794]:   WARNING: Not using device /dev/sdd1 for PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW.
Sep 09 16:08:04 matdesk lvm[794]:   WARNING: Autoactivation reading from disk instead of lvmetad.
Sep 09 16:08:04 matdesk lvm[794]:   WARNING: Not using lvmetad because cache update failed.
Sep 09 16:08:04 matdesk lvm[794]:   WARNING: Scan found duplicate PVs.
Sep 09 16:08:04 matdesk lvm[794]:   WARNING: Disabling lvmetad cache which does not support duplicate PVs.
Sep 09 16:08:04 matdesk lvm[794]:   WARNING: found device with duplicate /dev/sdd1
Sep 09 16:08:04 matdesk lvm[605]:   WARNING: PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW prefers device /dev/sdc1 because of previous pr>
Sep 09 16:08:04 matdesk lvm[605]:   WARNING: Not using device /dev/sdd1 for PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW.
Sep 09 16:08:04 matdesk lvm[605]:   WARNING: Not using lvmetad because cache update failed.
Sep 09 16:08:04 matdesk lvm[605]:   WARNING: Scan found duplicate PVs.
Sep 09 16:08:04 matdesk lvm[605]:   WARNING: Disabling lvmetad cache which does not support duplicate PVs.
Sep 09 16:08:04 matdesk lvm[605]:   WARNING: found device with duplicate /dev/sdd1

how do I fix it?

Thanks!

Personally I would at least see what pvdisplay, vgdisplay and lvdisplay have to say.

Are you using Linux MD under LVM?

yes, so… I have 2 disks in raid 1 of 500GB each, and two other separate disks of 1 TB each. The LVM volume group used to have three elements, the raid and the other two disks, and there was one logical volume composed of all three to create a single partition of 2.5TB.

here we go:

pvdisplay
  WARNING: found device with duplicate /dev/sdd1
  WARNING: found device with duplicate /dev/md127
  WARNING: Disabling lvmetad cache which does not support duplicate PVs.
  WARNING: Scan found duplicate PVs.
  WARNING: Not using lvmetad because cache update failed.
  WARNING: Not using device /dev/sdd1 for PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW.
  WARNING: Not using device /dev/md127 for PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW.
  WARNING: PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW prefers device /dev/sdc1 because of previous preference.
  WARNING: PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW prefers device /dev/sdc1 because of previous preference.
  --- Physical volume ---
  PV Name               /dev/sda1
  VG Name               dischi
  PV Size               931.51 GiB / not usable 4.69 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              238466
  Free PE               0
  Allocated PE          238466
  PV UUID               pKnTq5-QNQa-GZRc-OFwS-g9uv-eQf6-T3GIu8
   
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               dischi
  PV Size               931.51 GiB / not usable 4.69 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              238466
  Free PE               0
  Allocated PE          238466
  PV UUID               TR7nvi-iZz3-JoZ7-vnsg-Y8y1-E4ZX-88WtS2
   
  --- Physical volume ---
  PV Name               /dev/sdc1
  VG Name               dischi
  PV Size               465.76 GiB / not usable 2.88 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              119234
  Free PE               32
  Allocated PE          119202
  PV UUID               9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW


vgdisplay
  WARNING: found device with duplicate /dev/sdd1
  WARNING: found device with duplicate /dev/md127
  WARNING: Disabling lvmetad cache which does not support duplicate PVs.
  WARNING: Scan found duplicate PVs.
  WARNING: Not using lvmetad because cache update failed.
  WARNING: Not using device /dev/sdd1 for PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW.
  WARNING: Not using device /dev/md127 for PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW.
  WARNING: PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW prefers device /dev/sdc1 because of previous preference.
  WARNING: PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW prefers device /dev/sdc1 because of previous preference.
  --- Volume group ---
  VG Name               dischi
  System ID             
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               2.27 TiB
  PE Size               4.00 MiB
  Total PE              596166
  Alloc PE / Size       596134 / 2.27 TiB
  Free  PE / Size       32 / 128.00 MiB
  VG UUID               uB69eP-4fp1-HhcR-0SAd-Qcep-H4AV-BC5nGc
lvdisplay
  WARNING: found device with duplicate /dev/sdd1
  WARNING: found device with duplicate /dev/md127
  WARNING: Disabling lvmetad cache which does not support duplicate PVs.
  WARNING: Scan found duplicate PVs.
  WARNING: Not using lvmetad because cache update failed.
  WARNING: Not using device /dev/sdd1 for PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW.
  WARNING: Not using device /dev/md127 for PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW.
  WARNING: PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW prefers device /dev/sdc1 because of previous preference.
  WARNING: PV 9RQG3a-LDXs-PuuI-CgpU-YykV-ko4S-g4I5JW prefers device /dev/sdc1 because of previous preference.
  --- Logical volume ---
  LV Path                /dev/dischi/harddisks
  LV Name                harddisks
  VG Name                dischi
  LV UUID                zKn84M-N2XI-Kah0-b4z1-RKRt-EAqY-VKi2AX
  LV Write Access        read/write
  LV Creation host, time linux-5y1c, 2018-04-20 15:36:28 +0100
  LV Status              NOT available
  LV Size                2.27 TiB
  Current LE             596134
  Segments               3
  Allocation             inherit
  Read ahead sectors     auto

Now I have a feeling that I should filter out /dev/sdc1 and /dev/sdd1 and only let it see /dev/md127 so that the duplication issue should go away. Not sure how… and also why this wasn’t a problem before

While I can not explain what is wrong exactly, I do not think that filtering output in a way that warnings/errors are hidden is the way to go to correct your LVM configuration.

Something is wrong here and something else then looking away must be done IMHO.

I think I fixed it, at least temporarily. I’ll write here what I did in case it’s useful to other people.

In my understanding of what’s going on, lvm scans /dev for devices to add to lvm groups. It found two with the same ID, and refused to use them both saying a physical volume is duplicated. I am not sure if this should have happened in the first place, but it looks like when I created the software raid array, the raid itself /dev/md127 got the same ID as one of the two partitions in it /dev/sdd1.

I only want the raid in the LVM volume group, so I needed a way to tell lvm to ignore /dev/sdd1. Apparently that can be done by adding a filter in /etc/lvm/lvm.conf. It had a line that initially looked like this:

filter =  "r|/dev/.*/by-path/.*|", "r|/dev/.*/by-id/.*|", "r|/dev/fd.*|", "r|/dev/cdrom|", "a/.*/" ]

I added “r|/dev/sdd*|” so that it rejects /dev/sdd1 (I put the asterisk because I wasn’t sure whether that should be /dev/sdd or /dev/sdd1, and I didn’t bother testing both), and now it works.

The only thing is that this isn’t very general, and I’ll have to remember I’ve tainted my lvm.conf file if I ever mess with lvm again, or it may ignore some of my partitions and I will probably not remember or understand why.

LVM should automatically filter out Linux MD members.

        # Configuration option devices/md_component_detection.
        # Ignore devices that are components of software RAID (md) devices.
        md_component_detection = 1

Is it also enabled in your case?

yes it is… and yet it was giving that error about duplicate PVs. I also still don’t understand what it was doing differently before the update.