Backup/Move LXC Container

  1. Stop lxc container
$ sudo lxc-stop -n <container>
  1. Archive lxc container. DON’T forget the option ‘–numeric-owner’. The ‘–numeric-owner’ flag is very important! Without it, the container may not boot because the uid/gids get mangled in the extracted filesystem
$ sudo - su

$ cd /var/lib/lxc/<container>/

$ tar --numeric-owner -czvf container_fs.tar.gz ./*
  1. Copy the archive file to another server (ftp, sftp, or scp)
  2. Extract files on the new server
$ sudo su -

$ mkdir /var/lib/lxc/<container>/

$ cd /var/lib/lxc/<container>/

$ tar --numeric-owner -xzvf container_fs.tar.gz 
reference:

<http://stackoverflow.com/questions/23427129/how-do-i-backup-move-lxc-containers></li> </ol>
Written on November 2, 2016