Recently I wrote a tool called
lxc-slack to help me create
LXC containers without hassle. It has proved to be extremely useful to me, so I decided to share it with others in hope they may find any use of it, too.
I wrote this primarily to create virtual environments for testing my SlackBuilds. VirtualBox and similar virtualisation technologies are too heavy for my needs, because my CPU doesn't have virtualisation extensions and is otherwise not very fast (1.5GHz Core 2 Duo), but I wanted the ability to create snapshots from clean Slackware installation and ditch them after using. lxc-slack does exactly that by utilizing btrfs filesystem subvolume cloning (I created a separate partition for that, as my main ones are jfs).
Basically this script lets you create a Slackware "template" (which is btrfs subvolume) from installation directory (I'm mounting DVD ISO image for that). The template then is used as a base for snapshotting container. This is very quick due to btrfs copy-on-write behavior, it also doesn't take additional disk space until you start modifying the files. The final result is fully configured LXC container, ready to be used.
To get started you need to clone mercurial repository from bitbucket:
Code:
$ hg clone https://bitbucket.org/audriusk/lxc-slack
Then edit etc/lxc-slack.conf file and run ./lxc-slack to get help. More information can be found in README.rst.
So far I am very happy with this solution, except that fsck.btrfs takes a long time to do its job on each system boot. Need to check if there's anything I can do about it.