[lxc-users] Copying/cloning a container between nodes if LXC/LXD is not running

Fajar A. Nugraha list at fajar.net
Wed May 4 05:14:43 UTC 2016

On Wed, May 4, 2016 at 4:02 AM, Ron Kelley <rkelleyrtp at gmail.com> wrote:
> Greetings all,
> I updated some packages on my Ubuntu 15.10 server today which (when rebooted) caused the bridged networking to no longer work.  As a result, the LXD daemon would not start, in turn, preventing me from spinning up some containers.  After fixing the networking issue, I realized I don’t have an emergency plan/process to recover a container on Node-B if Node-A fails.
> I am looking for a way to rsync container-1 on Node-A to Node-B if/when LXC/LXD is not running on Node-A.  I realized the UID/GID values are different between the nodes, thus I need a way to sync the rootfs between nodes and remap the UID/GID properly.

The obvious, easy method would be to make sure that both nodes use the
same uidmap. Or use a privileged container (which would make uidmap

The "manual" way would be to simply sync it using the method of your
choice (e.g. "zfs send", "rsync -avPXx --numeric-ids --inplace
--delete --delete-after", or whatever), and manually shift the uids
later using fuidshift (from lxd-tools). I usualy do a reverse shift
(-r, look at current uids on the copied files/dir), verify that it's
now owned by root, and then shift it to the correct unpriv uid
(fuidshift, get uids from root's entry on /etc/subuid)


More information about the lxc-users mailing list