Quoting Fajar A. Nugraha (l...@fajar.net):
> On Tue, Apr 2, 2013 at 10:48 AM, Cody Doucette <douce...@bu.edu> wrote:
> 
> > Hi all,
> >
> > I'm a student and pretty new to LXC. I'm having a little bit of difficulty
> > and
> > hoping someone could point me in the right direction.
> >
> > A project that I'm working on has made some changes to the network stack
> > in the
> > Linux kernel, and we're looking to test those changes utilizing containers.
> 
> 
> What changes are they? You DO know that lxc uses the same kernel as the
> host, right?
> 
> If you wanted to modify the kernel and test the changes, then
> KVM/virtualbox/whatever would be a better choice.
> 
> 
> 
> > Each
> > of these containers should be a clone of the host system which is running
> > our
> > own custom version of the kernel under Ubuntu 12.10.
> >
> > So far I have a pretty simple LXC configuration file:
> >
> > lxc.utsname = my_container
> > lxc.tty = 4
> > lxc.network.type = veth
> > lxc.network.flags = up
> > lxc.network.link = br0
> > lxc.network.name = eth0
> > lxc.network.mtu = 1500
> > lxc.network.ipv4 = 0.0.0.0/24
> > lxc.rootfs = /var/lib/lxc/my_container
> > lxc.mount = /var/lib/lxc/fstab.lxc
> >
> > And a similarly simple fstab file:
> >
> > / /var/lib/lxc/my_container none bind 0 0
> >
> > And am (perhaps naively) trying to create a container with the above using:
> >
> > # lxc-create -f /var/lib/lxc/config.lxc -n my_container
> >
> > So naturally I was hoping after executing the above that
> > /var/lib/lxc/my_container would be a bind mount of / (root), but that was
> > not
> > the case. Eventually, each container of course does not need to be a
> > complete
> > copy of the host, but I figured I would start with trying to do a basic
> > clone of
> > everything and then pare it down to what is really needed.
> >
> > Could anyone nudge me in the right direction? Any tips would be
> > appreciated.

Apart from lxc-clone with btrfs or lvm, you could also use
lxc-start-ephemeral --keep-data to create overlayfs-based (or aufs
based, if your kernel supports it) clones.  So I generally do:

        lxc-create -t ubuntu -n a0
        lxc-start-ephemeral --keep-data -o a0 -n a1

log in, set up shut down, now you can use a1 as a regular container.
You can also clone it, which will result in another overlayfs-based
container based on a0's rootfs (with a1's delta copied over to start).
This will soon be integrated into lxc-clone itself so you don't have to
do the lxc-start-ephemeral step.

> 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.
> 
> If your changes are kernel-related, just clone the storage (e.g. using dd),
> then use KVM.
> 
> 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.

Hi Fajar,

what do you mean?  Apart from the fact that my systems tend to not start
out with a spare partition to into a PV :) I've not had trouble.

Since I'm getting ready to implement clone in the C api, if you're
having trouble I'd like to make sure I fix it while I'm doing so.

thanks,
-serge

------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete 
for recognition, cash, and the chance to get your game on Steam. 
$5K grand prize plus 10 genre and skill prizes. Submit your demo 
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
Lxc-users mailing list
Lxc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-users

Reply via email to