per default the following option in /etc/lvm/lvm.conf prevents lvm2 to work with loopback devices: obtain_device_list_from_udev = 0 Reproducible: Always Steps to Reproduce: 1. dd if=/dev/zero of=myimage.img bs=1024 count=20480 2. losetup -f myimage.img (assuming /dev/loop0 is free) 3. pvcreate /dev/loop0 Actual Results: PV creaed successfully but noy found by lvm Expected Results: PV creaed successfully and found by lvm
arg, the original setting is: obtain_device_list_from_udev = 1
The stock lvm.conf from upstream (2.02.88) has obtain_device_list_from_udev=1. You must have changed it at some point. You should go and alter the filter, or change that setting back
Sorry but you read the bug report wrongly, I corrected my statement in the second comment. The stock upstream setting prevents lvm to detect loopback devices, by using udev. Yes, I checked the filters and left them all default.
I don't follow, can you please clarify which setting of obtain_device_list_from_udev causes it to work? And you're sure your filters aren't excluding loop devices? I can't reproduce this with EITHER setting for obtain_device_list_from_udev, provided I add: |a/dev/loop.*| to my filter.
Created attachment 286363 [details] vanilla lvm.conf this is the lvm.conf after I deleted it and emerged sys-fs/lvm2-2.02.88 USE="lvm1 readline static static-libs (-clvm) (-cman) (-selinux)" 0 kB Here are my steps (ignore the /dev/ptmx -.-): disi-bigtop lvm_img # dd if=/dev/zero of=myimage.img bs=1024 count=20480 20480+0 records in 20480+0 records out 20971520 bytes (21 MB) copied, 0.0374487 s, 560 MB/s disi-bigtop lvm_img # losetup /dev/loop1 myimage.img disi-bigtop lvm_img # pvcreate /dev/loop1 File descriptor 5 (/dev/ptmx) leaked on pvcreate invocation. Parent PID 4729: -su Writing physical volume data to disk "/dev/loop1" Physical volume "/dev/loop1" successfully created disi-bigtop lvm_img # pvscan File descriptor 5 (/dev/ptmx) leaked on pvscan invocation. Parent PID 4729: -su No matching physical volumes found
disi-bigtop ~ # nano /etc/lvm/lvm.conf changed: obtain_device_list_from_udev = 0 disi-bigtop ~ # pvscan File descriptor 5 (/dev/ptmx) leaked on pvscan invocation. Parent PID 14681: -su PV /dev/loop1 lvm2 [20.00 MiB] Total: 1 [20.00 MiB] / in use: 0 [0 ] / in no VG: 1 [20.00 MiB]