0

I have a Debian server running KVM+libvirt. The VMs disks are LVs on the host. The trouble is that if I create LVs inside the guests, they are recursively detected on the host and that creates all sort of problems, like the inability to resize or delete properly LVs.

So I added a filter rule to /etc/lvm/lvm.conf like this, to exclude scanning LVs inside other LVs:

filter = [ "r|/dev/dm-*|", "a|/dev/sd.*|" ]

Now my problem is : how do I get LVM to rescan only the "real" VGs and LVs? I now have errors like this:

# lvs
  WARNING: Device for PV 73C0Ma-sAYV-Aa10-pAHB-ZAZA-3QjH-Rk1eTS not found or rejected by a filter.
  WARNING: Device for PV fcEG5k-BLzO-dbAr-Yw8o-dPw2-1hAk-VyluvW not found or rejected by a filter.
  LV              VG              Attr       LSize    Pool Origin    Data%  Meta%  Move Log Cpy%Sync Convert
  HaProxy         data            -wi-ao----   20,00g                                                       
  backup          data            -wi-ao----    4,00t                                                       
  database        data            -wi-ao----   16,00g                                                       
  lvol0           data            swi-a-s---   16,07g      stone-web 70,43                                  
  stone-vtls      data            -wi-ao----    2,00t                                                       
  stone-web       data            owi-aos---   16,00g                                                       
  lv0             ftpstorage      -wi-----p-   10,00t                                                       

The last lv in this case is actually a LV from a VM, not from the host... How do I get rid of it without rebooting the host?

  • could you provide some informations about your physical volumes? what kind of disk backend are you using as disk for the vm? – c4f4t0r Feb 29 at 23:36
  • There is a RAID array used as pv for the vg, split in lvs. The lvs are the disks for the VMs (using virtio). – wazoox Mar 1 at 14:52
  • but in your quenstion, include the output of pvs in the physical host – c4f4t0r Mar 1 at 16:23
4
+100

As per pvscan man page and RHEL documentation the following should work: /etc/lvm/lvm.conf

global_filter = [ "r|/dev/dm-*|", "a|/dev/sd.*|" ]
pvscan --cache

https://www.systutorials.com/docs/linux/man/8-pvscan/

To prevent devices from being scanned by pvscan --cache,
add them to lvm.conf(5) devices/global_filter.
The devices/filter setting does not apply to system level
scanning. For more information, see:
    lvmconfig --withcomments devices/global_filter 

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/lvm_filters

| improve this answer | |
  • I've tried pvscan --cache, pvscan, vgscan -ay and vgscan -an, no dice. lvs, vgs still outputs the same error. – wazoox Mar 1 at 14:51
  • Did you update your config to global_filter instead of filter? What does lvm dumpconfig show? – hargut Mar 1 at 16:02
  • How does the output of blkid look like? – hargut Mar 1 at 16:12
  • Ah yes my bad, with global_filter the problem is solved! – wazoox Mar 1 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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