Proper way of handling LXC containers on btrfs
Solution 1:
I am on Ubuntu LTS 14 and just ran the following (for first time even) and it worked like a charm:
lxc-stop -n ubuntu_base
lxc-clone -o ubuntu_base -n ubuntu_base_c1 -s
lxc-start -n ubuntu_base_c1 -d # make changes if needed
lxc-stop -n ubuntu_base_c1
lxc-snapshot -n ubuntu_base_c1
Using -s with lxc-clone will take a snapshot if backing store is btrfs (in your case).
Verify new clone/snapshots with
lxc-ls -f
btrfs subvolume list /var/lib/lxc
Hope that helps!
Solution 2:
if you will use btrfs subvolumes for lxc, you need add the option user_subvol_rm_allowed
in your /etc/fstab
. Example extracted from one fstab file:
UUID=XXXXXXXXXXXXXXXXXXXXXX / btrfs subvol=@,user_subvol_rm_allowed,defaults 0 0
the option will permit that you can remove subvol without be root, only normal user. This capability is used by lxc when the snapshots go in btrfs subvolumes