Changes

Jump to navigation Jump to search
161 bytes added ,  14:32, 9 October 2012
do NOT use first-level headings; add intro; use nowiki for curl cmdline; more formatting
Line 1: Line 1: −
=Prepare a Linux Container=
+
This article describes how to perform checkpoint-restore for an LXC container.
==Requirements==
  −
* A console should be disabled (lxc.console = none)
  −
* udev should not run inside containers ($ mv /sbin/udevd{,.bcp})
     −
== Preparing a host environment ==
+
== Preparing a Linux Container ==
 +
 
 +
=== Requirements ===
 +
 
 +
* A console should be disabled (<code>lxc.console = none</code>)
 +
* udev should not run inside containers (<code>mv /sbin/udevd{,.bcp}</code>)
 +
 
 +
=== Preparing a host environment ===
    
* Mount cgroupfs
 
* Mount cgroupfs
 
  $ mount -t cgroup c /cgroup
 
  $ mount -t cgroup c /cgroup
 +
 
* Create a network bridge
 
* Create a network bridge
 
  # cat /etc/sysconfig/network-scripts/ifcfg-br0  
 
  # cat /etc/sysconfig/network-scripts/ifcfg-br0  
Line 21: Line 26:  
  ONBOOT="yes"
 
  ONBOOT="yes"
 
  BRIDGE=br0
 
  BRIDGE=br0
==Create and start a container==  
+
 
 +
=== Create and start a container ===
 
* Download an OpenVZ template and extract it.
 
* Download an OpenVZ template and extract it.
curl http://download.openvz.org/template/precreated/centos-6-x86_64.tar.gz | tar -xz -C test-lxc
+
<pre><nowiki>curl http://download.openvz.org/template/precreated/centos-6-x86_64.tar.gz | tar -xz -C test-lxc
 
+
</nowiki></pre>
 
* Create config files
 
* Create config files
 
  $ cat ~/test-lxc.conf  
 
  $ cat ~/test-lxc.conf  
Line 49: Line 55:  
  $ lxc-start -n test-lxc
 
  $ lxc-start -n test-lxc
   −
= Checkpoint and restore an LXC Container =
+
== Checkpoint and restore an LXC Container ==
== Preparations ==
+
 
 +
=== Preparations ===
 +
 
 
You not only need to [[Installation | install]] the crtools, but also check that the iproute2 utility (<code>ip</code>) is not v3.5.1 or earlier.
 
You not only need to [[Installation | install]] the crtools, but also check that the iproute2 utility (<code>ip</code>) is not v3.5.1 or earlier.
 +
 
Since v3.5.2 is not yet released (as per 20 Sept 2012), you should compile it from [http://git.kernel.org/?p=linux/kernel/git/shemminger/iproute2.git;a=summary sources]. In order to tell to crtools where the proper ip tool is set the <code>CR_IP_TOOL</code> environment variable.
 
Since v3.5.2 is not yet released (as per 20 Sept 2012), you should compile it from [http://git.kernel.org/?p=linux/kernel/git/shemminger/iproute2.git;a=summary sources]. In order to tell to crtools where the proper ip tool is set the <code>CR_IP_TOOL</code> environment variable.
   −
== Dump and restore ==
+
=== Dump and restore ===
 
Dumping and restoring an LXC contianer means -- dumping a subtree of processes starting from container init plus all kinds of namespaces.
 
Dumping and restoring an LXC contianer means -- dumping a subtree of processes starting from container init plus all kinds of namespaces.
 
Restoring is symmetrical. The way LXC container works imposes some more requirements on crtools usage.
 
Restoring is symmetrical. The way LXC container works imposes some more requirements on crtools usage.
Line 89: Line 98:  
More details on the option mentioned can be found in [[Usage]] and [[Advanced usage]] pages.
 
More details on the option mentioned can be found in [[Usage]] and [[Advanced usage]] pages.
   −
== Example ==
+
=== Example ===
 
We have [http://git.criu.org/?p=crtools.git;a=tree;f=test/app-emu/lxc;hb=HEAD an application test] for dumping/restoring an LXC Container. You may look at it for better understanding how to dump and restore your container with crtools.
 
We have [http://git.criu.org/?p=crtools.git;a=tree;f=test/app-emu/lxc;hb=HEAD an application test] for dumping/restoring an LXC Container. You may look at it for better understanding how to dump and restore your container with crtools.
  

Navigation menu