1

i have a dedicated server with Ubuntu 15 Wily and i want to play/study with LXC. My main goal is to snapshot and clone containers without stopping them, and for so i have formatted a partition with BTRFS file sistem.

root@lxc:/btrfs-partition/lxc-subvolume02# btrfs subvolume list /btrfs-partition/
ID 256 gen 10 top level 5 path ext2_saved
ID 260 gen 34 top level 5 path lxc-subvolume
ID 261 gen 745 top level 5 path lxc-subvolume02
ID 262 gen 740 top level 261 path lxc-subvolume02/www05btrfs/rootfs
ID 263 gen 740 top level 261 path lxc-subvolume02/www05btrfs/snaps/snap0/rootfs

this is the partition layout where "/btrfs-partition" it the btrfs forlder mounted

ID 262 gen 740 top level 261 path lxc-subvolume02/www05btrfs/rootfs

this container has been created with this command:

lxc-create -B btrfs -n www05btrfs -t debian -- -r wheezy -a amd64

when i have tried to take a snapshot:

lxc-snapshot -n www05btrfs

i have received this error:

lxc-snapshot: lxccontainer.c: do_lxcapi_clone: 2795 error: Original container (www05btrfs) is running
lxc-snapshot: lxccontainer.c: do_lxcapi_snapshot: 3113 clone of /btrfs-partition/lxc-subvolume02:www05btrfs failed
lxc-snapshot: lxc_snapshot.c: do_snapshot: 55 Error creating a snapshot

I thought that i have first to create a comment file, so i have:

echo "some comment bla bla bla" > snap-comment
lxc-snapshot -n www05btrfs -c snap-comment

but same error:

lxc-snapshot: lxccontainer.c: do_lxcapi_clone: 2795 error: Original container (www05btrfs) is running
lxc-snapshot: lxccontainer.c: do_lxcapi_snapshot: 3113 clone of /btrfs-partition/lxc-subvolume02:www05btrfs failed
lxc-snapshot: lxc_snapshot.c: do_snapshot: 55 Error creating a snapshot

but if i stop the container and create a comment everything works:

root@lxc:/btrfs-partition/lxc-subvolume02# lxc-stop -n www05btrfs
root@lxc:/btrfs-partition/lxc-subvolume02# lxc-snapshot -n www05btrfs -c snap-comment
root@lxc:/btrfs-partition/lxc-subvolume02# lxc-start -n www05btrfs
root@lxc:/btrfs-partition/lxc-subvolume02# lxc-snapshot -n www05btrfs -L -C
snap0 (/btrfs-partition/lxc-subvolume02/www05btrfs/snaps) 2015:11:08 09:36:26
before installing apache2

So, can anyone help me with a working procedure to snapshot correctly LXC Containers with BTRFS fs?

i have been reading this : https://www.stgraber.org/2013/12/27/lxc-1-0-container-storage/

and this Proper way of handling LXC containers on btrfs

but none works as described. thank you

x86fantini
  • 13
  • 3
  • i have tried also with Ubuntu 14 LTS and Debian 8 Jessie. The same problem: if i try to snapshot or clone a running container (even with btrfs datastore) it says that container is running. Obvisuslly no issue for clone/snapshot with container stopped – x86fantini Nov 09 '15 at 08:58

0 Answers0