0

Requirement: Create two trusty containers each on its own disk so I could setup a 2-node mongodb replica set. My idea was to create two LVM volume groups so that each container owns its own volume group (and disks associated).

sgireddy@sbox02:/var/lib$ lxc config show
config:
  images.remote_cache_expiry: "10"
  storage.lvm_thinpool_name: thinpool1
  storage.lvm_vg_name: vgpool1

Then I was able to create a container on this new volume group.

Now I wan to switch over to my second volume group, but lxc is not letting me to do do that.

sgireddy@sbox02:/var/lib$ lxc config set storage.lvm_vg_name vgpool2
error: Can not change LVM config. Images or containers are still using LVs: [db01 ***]

Can somebody please suggest a solution or workaround?

sgireddy
  • 155
  • 10

1 Answers1

0

LXD only supports a single backing store at a time and it uses it for everything, not just containers (so also images and snapshots).

It sounds like in your case what you want to do is have a VG used by LXD to store its stuff (containers, images, snapshots) and then add a separate "device" for each container which comes from either of your storage VGs.

Specifically, you want to look into "disk" type devices. A "disk" entry for a container can either be a partition that gets mounted onto a given path inside the container or a path on the host to bind-mount onto a given path inside the container.

Those can be added and removed live and may be set read-only too.

stgraber
  • 256
  • 1
  • 5
  • I followed procedure mentioned here: http://askubuntu.com/questions/528161/how-to-make-a-hdd-device-file-dev-sdxy-available-in-lxc-container sgireddy@sboxv1:~$ sudo cat /var/lib/lxd/containers/db01/fstab /dev/sdb1 mnt/sdb ext4 noatime 0 0 sgireddy@sboxv1:~$ sudo cat /var/lib/lxd/containers/db01/config lxc.mount = /var/lib/lxd/containers/db01/fstab got following: examining sdb in /usr/lib/x86_64-linux-gnu/lxc/mnt/sdb lxc 1448851772.747 ERROR lxc_conf - conf.c:mount_entry:1731 - No such file or directory - failed to mount '/dev/sdb1' on '/usr/lib/x86_64-linux-gnu/lxc/mnt/sdb' – sgireddy Nov 30 '15 at 03:09