{"id":863,"date":"2020-01-27T07:09:04","date_gmt":"2020-01-27T07:09:04","guid":{"rendered":"http:\/\/www.tech-g.com\/?p=863"},"modified":"2021-07-20T08:14:57","modified_gmt":"2021-07-20T08:14:57","slug":"backup-an-lxc-container","status":"publish","type":"post","link":"https:\/\/www.voodoo.business\/blog\/2020\/01\/27\/backup-an-lxc-container\/","title":{"rendered":"Backup or move an LXC container"},"content":{"rendered":"<p>You can not just copy an LXC container, wat you need to do is among the lines of<\/p>\n<pre>cd \/var\/lib\/lxc\ntar --numeric-owner -cf container_125_fs.tar vm125\n<\/pre>\n<p>The magic is mainly about maintaining the numeric owner of files, which is lost when you copy the files using the host machine \ud83d\ude09<\/p>\n<p>you can untar it the same way you untar any other tar file.<\/p>\n<p>for example, to untar it to a different location, you can use the command<\/p>\n<pre>tar -xf container_125_fs.tar -C \/target\/directory<\/pre>\n\n\n<p>This whole thing is very useful in moving a container to a different directory, then modifying the config file to point to that directory, as well as moving it to a different machine, the reason you can&#8217;t just move it is that moving will cause some issues as the move command does not take the ownership differences between host and guest into account.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can not just copy an LXC container, wat you need to do is among the lines of cd \/var\/lib\/lxc tar &#8211;numeric-owner -cf container_125_fs.tar vm125 The magic is mainly about maintaining the numeric owner of files, which is lost when you copy the files using the host machine \ud83d\ude09 you can untar it the same [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-863","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/863","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/comments?post=863"}],"version-history":[{"count":5,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/863\/revisions"}],"predecessor-version":[{"id":1208,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/863\/revisions\/1208"}],"wp:attachment":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/media?parent=863"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/categories?post=863"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/tags?post=863"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}