1. To clone a container, we use lxc-clone command. The option -B btrfs creates a Btrfs volume which later can be used for snapshot clones. Snapshot clones are similar to linked clones of Virtualbox.
# lxc-clone -B btrfs c1 c2
2. We can use -s option to create a snapshot volume.
# lxc-clone -s -B btrfs c2 c3
Here are some useful Btrfs commands to get more information about underlying volumes of Btrfs.
1. Listing subvolumes
# btrfs subvolume list /vm ID 257 gen 187 top level 5 path vm ID 260 gen 168 top level 257 path c2/rootfs ID 261 gen 168 top level 257 path c3/rootfs
2. Getting details of a subvolume
# btrfs subvolume show /vm/c2/rootfs /vm/c2/rootfs Name: rootfs uuid: 68628679-d0ae-724a-be01-5ba74e2c00b1 Parent uuid: - Creation time: 2015-11-24 17:34:33 Object ID: 260 Generation (Gen): 168 Gen at creation: 161 Parent: 257 Top Level: 257 Flags: - Snapshot(s): vm/c3/rootfs
3. Enable quotas and see disk usage of subvolumes
# btrfs quota enable /vm # btrfs qgroup show /vm qgroupid rfer excl -------- ---- ---- 0/5 16384 16384 0/257 827707392 827707392 0/260 825425920 7421952 0/261 825425920 7421952 0/263 825425920 7421952
Here rfer column shows total bytes of data referred by subvolume, and excl column shows bytes of data exclusive for the volume that is not shared with other volumes.
No comments:
Post a Comment