User Tools

Site Tools


wiki:lxc_commands

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
wiki:lxc_commands [2022/10/08 11:35] – add rename container antisawiki:lxc_commands [2022/10/08 11:38] (current) – add lxc mount host directory and move containers antisa
Line 26: Line 26:
   lxc.rootfs = /var/lib/lxc/newname/rootfs   lxc.rootfs = /var/lib/lxc/newname/rootfs
   lxc.mount = /var/lib/lxc/newname/fstab   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 ====== ====== Tested on ======
   *    * 
Line 32: Line 47:
  
 ====== References ====== ====== References ======
 +  * http://stackoverflow.com/questions/23427129/how-do-i-backup-move-lxc-containers
  
wiki/lxc_commands.1665221755.txt.gz · Last modified: 2022/10/08 11:35 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki