[Lxc-users] moving LXC containers to a new server

Gordon Henderson gordon at drogon.net
Sun Nov 6 11:21:41 UTC 2011


On Sun, 6 Nov 2011, Geordy Korte wrote:

> Hello all,
>
> Just a quick question. I have LXC running on a server and have purchased a
> new server. Now I would like to copy the LXC's to the new server. Do I need
> to do anything special with the cgroups or just copy the containers from
> /var/lib/lxc and then start them?

Copy the containers (and config file and fstab), then lxc-create and start 
them.

A few things to bear in-mind:

Preserve user IDs when copying: I use rsync - so use the --numeric-ids 
parameter.

To minimise down time: rsync while it's live, lxc-create on the new 
server, shutdown the container on the old server, rsync again, then 
lxc-start on the new server. (and finally lxc-destroy on the old server 
in-case it auto-starts after a reboot!)

Gordon




More information about the lxc-users mailing list