Backup/Move LXC Container
- Stop lxc container
$ sudo lxc-stop -n <container>
- 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 ./*
- Copy the archive file to another server (ftp, sftp, or scp)
- 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