<div dir="ltr">On Tue, Apr 2, 2013 at 10:48 AM, Cody Doucette <span dir="ltr"><<a href="mailto:doucette@bu.edu" target="_blank">doucette@bu.edu</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I'm a student and pretty new to LXC. I'm having a little bit of difficulty and<br>
hoping someone could point me in the right direction.<br>
<br>
A project that I'm working on has made some changes to the network stack in the<br>
Linux kernel, and we're looking to test those changes utilizing containers.</blockquote><div><br></div><div style>What changes are they? You DO know that lxc uses the same kernel as the host, right?</div><div style><br>
</div><div style>If you wanted to modify the kernel and test the changes, then KVM/virtualbox/whatever would be a better choice.</div><div style><br></div><div style> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 Each<br>
of these containers should be a clone of the host system which is running our<br>
own custom version of the kernel under Ubuntu 12.10.<br>
<br>
So far I have a pretty simple LXC configuration file:<br>
<br>
lxc.utsname = my_container<br>
lxc.tty = 4<br>
lxc.network.type = veth<br>
lxc.network.flags = up<br>
lxc.network.link = br0<br>
<a href="http://lxc.network.name" target="_blank">lxc.network.name</a> = eth0<br>
lxc.network.mtu = 1500<br>
lxc.network.ipv4 = <a href="http://0.0.0.0/24" target="_blank">0.0.0.0/24</a><br>
lxc.rootfs = /var/lib/lxc/my_container<br>
lxc.mount = /var/lib/lxc/fstab.lxc<br>
<br>
And a similarly simple fstab file:<br>
<br>
/ /var/lib/lxc/my_container none bind 0 0<br>
<br>
And am (perhaps naively) trying to create a container with the above using:<br>
<br>
# lxc-create -f /var/lib/lxc/config.lxc -n my_container<br>
<br>
So naturally I was hoping after executing the above that<br>
/var/lib/lxc/my_container would be a bind mount of / (root), but that was not<br>
the case. Eventually, each container of course does not need to be a complete<br>
copy of the host, but I figured I would start with trying to do a basic clone of<br>
everything and then pare it down to what is really needed.<br>
<br>
Could anyone nudge me in the right direction? Any tips would be appreciated.<br>
<br></blockquote><div><br></div><div style>Even if it worked, you'd have major problems as programs (e.g. syslog) will try to write the same file that was already open in the host system.</div><div style><br></div><div style>
If your changes are kernel-related, just clone the storage (e.g. using dd), then use KVM.</div><div style><br></div><div style>If your changes are NOT kernel-related, then the easy way is if the root filesystem is on a snapshot/clone-capable fs (e.g. btrfs,zfs). Otherwise just use plain tar/rsync/whatever to copy the filesystem. I do NOT recommend using LVM snapshot as (from experience) it's more hassle than what it's worthed.</div>
<div style><br></div><div style>Regards,</div><div style><br></div><div style>Fajar</div></div></div></div>