How to declare an lxc container's 'backingstore type' in LuCi?

As both lxc-snapshot and lxc-clone seem fixed by @cynerd I would expect people to want to make use of it (if they have a layerd file-system in place)!

To do so the containers must have a layerd file-system as their backing store (btrfs, aufs, etc.) However, I do not know how to make a container use btrfs (in my case) whilst using LuCi (which seems to default to a directory-backed sore). So now I see two options:

  1. Create them from LuCi, and make a clone of them later using lxc-clone -B btrfs <original-name> <clone- name> from the command line (to make a “snapshottable” clone).

  2. Create the containers from CLI to begin with with the following command: lxc-create -n <containername> -t download -P /srv/lxc/ -- -d <distribution> -r <release> -a <architecture> -B btrfs (in theory never done this yet).

Is there (also) a way to declare the backing store type at the time of creation via the LuCi graphical (web) interface?

FYI, there is a slight typo:

root@router:~# lxc-create -n ubuntu -t download -P /srv/lxc/ -- -d Ubuntu -r Xenial -a armv7l -B btrfs
getopt: unrecognized option: B
lxc-create: lxccontainer.c: create_run_template: 1201 container creation template for ubuntu failed
lxc-create: lxc_create.c: main: 274 Error creating container ubuntu

Instead, this seems to work (note -B has moved, and the architecture is arm7-ell, not arm7-one):

root@router:~# lxc-create -n ubuntu -t download -P /srv/lxc/ -B btrfs -- -d Ubuntu -r Xenial -a armv7l
Setting up the GPG keyring
Downloading the image index
Downloading the rootfs
Downloading the metadata
The image cache is now ready
Unpacking the rootfs

---
Distribution Ubuntu version Xenial was just installed as a container.

Content of the tarballs is provided by third party, thus there is no warranty of any kind nor support from Turris team.

Do not use containers on internal flash, they can wear it down really fast!!!


And after downloading the template, I suggest:

root@router:/srv/lxc# cat >> /tmp/comment <<"EOF"
> Template only (no changes after lxc-create)
>  - created via: lxc-create -n ubuntu -t download -P /srv/lxc/ -B btrfs -- -d Ubuntu -r Xenial -a armv7l
>
> EOF

And then:

root@router:/srv/lxc# lxc-snapshot -n ubuntu --comment=/tmp/comment
2 Likes