Issue creating LVM storage pool with source

I have a freshly installed Ubuntu Server 20.04 on which I am attempting to create an LVM storage pool with a Logical Volume which I created on OS installation.

However I get the following error when attempting to create the storage pool:

$ lxc storage create test lvm source=/dev/ubuntu-vg/lxd-storage
Error: Failed to run: pvcreate /dev/ubuntu-vg/lxd-storage: Failed to clear hint file.
  Device /dev/ubuntu-vg/lxd-storage excluded by a filter.

I have previously created the storage pool multiple times with the same steps and have not observed this error.

The /etc/lvm/lvm.conf file has all filters commented out by default.

Following are details regarding the Logical Volume:

$ sudo lvdisplay -v /dev/ubuntu-vg/lxd-storage
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/lxd-storage
  LV Name                lxd-storage
  VG Name                ubuntu-vg
  LV UUID                SusZnB-2crM-IblT-6Ovc-KA9v-YeVL-LroQ1c
  LV Write Access        read/write
  LV Creation host, time ubuntu-server, 2021-08-17 11:39:32 +0000
  LV Status              available
  # open                 0
  LV Size                829.98 GiB
  Current LE             212476
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

Any tips are appreciated.

This seems like quite an unusual thing to attempt - if I’m reading this correctly you’re trying to create a LVM volume group (and physical volume) ontop of an existing logical volume.

Is there a reason you’re doing this, rather than just creating a volume group and then using that as the source name, e.g.

lxc storage create test lvm source=my-volumegroup-name

On Ubuntu installation I limited the boot partition LV’s size and used the rest of the disk space to create an unformatted LV /dev/ubuntu-vg/lxd-storage. I initially assumed that LXD would be able to use the unformatted LV to create the storage pool (which worked without errors before) but it seems to be giving me issues now.

Both my LVs are as follows:

$ sudo lvdisplay
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/ubuntu-lv
  LV Name                ubuntu-lv
  VG Name                ubuntu-vg
  LV UUID                yIUUwI-P8jw-bVKo-4GLp-8ita-Of1G-cMavBF
  LV Write Access        read/write
  LV Creation host, time ubuntu-server, 2021-08-17 11:39:26 +0000
  LV Status              available
  # open                 1
  LV Size                100.00 GiB
  Current LE             25600
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/lxd-storage
  LV Name                lxd-storage
  VG Name                ubuntu-vg
  LV UUID                SusZnB-2crM-IblT-6Ovc-KA9v-YeVL-LroQ1c
  LV Write Access        read/write
  LV Creation host, time ubuntu-server, 2021-08-17 11:39:32 +0000
  LV Status              available
  # open                 0
  LV Size                829.98 GiB
  Current LE             212476
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

Do you want to use lvm pool on your disk or dir pool on your logical volume?

We don’t recommend creating an lvm pool inside another logical volume.

Instead I would suggest removing that /dev/ubuntu-vg/lxd-storage LV and then instructing LXD to re-use the ubuntu-vg volume group, using:

lxc storage create lvm lvm source=ubuntu-vg lvm.vg.force_reuse=true

This is still not ideal, as we don’t encourage sharing volume groups with other applications (or OSes) but at least its not nesting LVM.

When we switched to Ubuntu Focal as the snap base the more recent LVM subsystem prevents nesting LVMs by default - as its not recommended by LVM upstream.

That did work, thanks for the tip! In the meantime I’ll have to resort to VG sharing.

1 Like