[lxc-users] lxc-clone and LVM backingstorage

Thomas Dalichow info at thomasdalichow.de
Wed Feb 26 23:32:30 UTC 2014


Cheers guys,

I'm currently fooling around a little with LXC 1.0 on the latest Ubuntu
(Desktop) 14.04 daily build (current).

I created a physical volume and a volume group on top of it named vg1
and created a container as follows:

   $: lxc-create -t download -n 1 -B lvm --fssize 1G --vgname vg1
--lvname lv-1 -- -d ubuntu -r trusty -a amd64

This worked...

   Logical volume "lv-1" created
   Setting up the GPG keyring
   Downloading the image index
   Downloading the rootfs
   Downloading the metadata
   The image cache is now ready
   Unpacking the rootfs

   ---
   You just created an Ubuntu container (release=trusty, arch=amd64).

Now on trying to clone I got the error

   $: lxc-clone -o 1 -n 2
     Volume group "vg2" not found
   lxc_container: Error creating new lvm blockdev
   lxc_container: failed getting pathnames for cloned
storage: /dev/vg1/lv-1
   lxc_container: Error copying storage

Renaming the volume group (vg1) to "lxc" and renaming the logical volume
of the container (lv-1) and of course modifying the rootfs of container
"1" did the trick:

   $: vgrename vg1 lxc
     Volume group "vg1" successfully renamed to "lxc"
   $: lvrename /dev/lxc/lv-1 1
     Renamed "lv-1" to "1" in volume group "lxc"
   $: lxc-clone -o 1 -n 2
     Logical volume "2" created
   Created container 2 as copy of 1

Now here's my question: is there any naming convention to adhere to in
order for LXC (especially lxc-clone) to determine the correct name of
the new LVM device and the underlying volume group?

Regards,
Thomas





More information about the lxc-users mailing list