Can not create lvm backstore for lxc

Hi, i am trying to create an lxc container with lvm instead of dir. but i krep getting error; please advice.

sudo lxc-create -n test -t ubuntu  --bdev lvm  
  Volume group "lxc" not found
  Cannot process volume group lxc
lxc-create: storage/lvm.c: lvm_create: 421 Error creating new lvm blockdev /dev/lxc/test size 1073741824 bytes
lxc-create: lxccontainer.c: do_storage_create: 1172 Failed to create backing store type lvm
lxc-create: lxccontainer.c: do_lxcapi_create: 1649 Error creating backing store type lvm for test
lxc-create: tools/lxc_create.c: main: 326 Error creating container test


sudo lxc-create -n test -t ubuntu  --bdev lvm --lvname test --vgname test --fstype ext4 --fssize 10G
  Volume group "test" not found
  Cannot process volume group test
lxc-create: storage/lvm.c: lvm_create: 421 Error creating new lvm blockdev /dev/test/test size 10737418240 bytes
lxc-create: lxccontainer.c: do_storage_create: 1172 Failed to create backing store type lvm
lxc-create: lxccontainer.c: do_lxcapi_create: 1649 Error creating backing store type lvm for test
lxc-create: tools/lxc_create.c: main: 326 Error creating container test

I presume noone knows the solution for this?

Try passing -o debug -l debug and paste the content of the debug file.

Hi Stephane;

            sudo lxc-create -n test -t ubuntu  --bdev lvm --lvname test --vgname test --fstype ext4 --fssize 10G --logfile=logger --logpriority=DEBUG
              Volume group "test" not found
              Cannot process volume group test
            lxc-create: storage/lvm.c: lvm_create: 421 Error creating new lvm blockdev /dev/test/test size 10737418240 bytes
            lxc-create: lxccontainer.c: do_storage_create: 1172 Failed to create backing store type lvm
            lxc-create: lxccontainer.c: do_lxcapi_create: 1649 Error creating backing store type lvm for test
            lxc-create: tools/lxc_create.c: main: 326 Error creating container test
            user:~> cat logger 
                 lxc-create 20180730162419.133 INFO     lvm - storage/lvm.c:do_lvm_create:108 - got 0 for thin pool at path: /dev/test/lxc
                 lxc-create 20180730162419.138 ERROR    lvm - storage/lvm.c:lvm_create:421 - Error creating new lvm blockdev /dev/test/test size 10737418240 bytes
                 lxc-create 20180730162419.138 ERROR    lxc_container - lxccontainer.c:do_storage_create:1172 - Failed to create backing store type lvm
                 lxc-create 20180730162419.138 ERROR    lxc_container - lxccontainer.c:do_lxcapi_create:1649 - Error creating backing store type lvm for test
                 lxc-create 20180730162419.138 ERROR    lxc_create_ui - tools/lxc_create.c:main:326 - Error creating container test

it did not allow me to use code tags!!

@brauner any ideas?

What does:

sudo vgdisplay

show?

sudo vgdisplay
empty "no output"

The volume group you’re specifying and in which the new logical volume is supposed to be created needs to exist. LXC will currently not create it itself.

bare with me, can you guide me how to make it happen?
what is the right way isolating the container files? is it lvm or qcow2 or its already isolated with dir?
if it happen you know how creating a container using qcow2, please example me?
Thanks.

There are multiple guides on the internet on how to create volume groups. One is:
https://www.centos.org/docs/5/html/Cluster_Logical_Volume_Manager/VG_create.html

Dir is fine as well. Usually LVM and friends are used to get features such as cheap snapshots and so on but it’s not required.

1 Like