{{tag>lxc vm virtualization}} ====== lxc commands ====== ===== create centos 6 ===== lxc-create -n bitrix-dev -t centos -- -R 6 ===== create debian wheezy container ===== lxc-create -n -t debian -- -r wheezy ===== LXC rename container ===== 1. Shutdown container lxc-stop -n 2. Open Terminal/Shell, Rename container root directory sudo mv /var/lib/lxc/oldname /var/lib/lxc/newname 3. Rename hostname and paths in config sudo vim /var/lib/lxc/newname/config lxc.utsname = newname lxc.rootfs = /var/lib/lxc/newname/rootfs lxc.mount = /var/lib/lxc/newname/fstab ===== lxc mount host directory inside container ===== Add to config: lxc.mount.entry=/backup /var/lib/lxc/mycontainer/rootfs/backup none bind 0 0 ===== Moving lxc containers ===== cd /var/lib/lxc/$NAME/ tar --numeric-owner -czvf container_fs-$(date +%Y%m%d).tar.gz ./* From one partition to another: cp -a /data2/lxc/mycontainer /data/lxc/ ====== Tested on ====== * ====== See also ====== ====== References ====== * http://stackoverflow.com/questions/23427129/how-do-i-backup-move-lxc-containers