<div dir="ltr"><div class="gmail_default" style="font-size:small">I normally copy containers with rsync, to a different server, and with plain "  cp -dpR --sparse=never" in the same box. Should I use tar instead? I noticed that rsync is slow, even in the same network <br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 4, 2015 at 3:04 PM, Mark S.S. Slatter <span dir="ltr"><<a href="mailto:mslatter@maximumcomm.com" target="_blank">mslatter@maximumcomm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">For what it's worth, my notes from various research indicate:<div><br></div><div><div>======= MOVING LXC CONTAINERS =====</div><div> When moving from one server to another, important NOT to copy it.  All permissions</div><div> inside container must be preserved.  This is done by the following:</div><div><br></div><div>On OLD server</div><div>tar --numeric-owner -czvf mycontainer.tgz /var/lib/lxc/my_container</div><div><br></div><div>On NEW server</div><div>tar --numeric-owner -xzvf mycontainer.tgz -C /var/lib/lxc/</div><div><br></div><div>Be sure to set the appropriate IP address info on new location if it will change.</div></div><div>==============================</div><div>I believe this is what I used the last time and it worked.</div><div><br></div><div>Thanks,</div><div><br></div><div>Mark.</div></div><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">On Fri, Dec 4, 2015 at 12:43 PM Bostjan Skufca <<a href="mailto:bostjan@a2o.si" target="_blank">bostjan@a2o.si</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">"man tar"<div><br></div><div><a href="https://www.google.si/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=tar%20preserve%20everything" target="_blank">https://www.google.si/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=tar%20preserve%20everything</a><br></div><div><br></div><div>I would suggest -p and --numeric-owner and maybe --acl and --xattrs, but, as I said before, I generally use rsync.</div><div><br></div></div><div dir="ltr"><div>b.</div><div><br></div></div><div class="gmail_extra"><div class="gmail_quote">On 4 December 2015 at 18:20, Saint Michael <span dir="ltr"><<a href="mailto:venefax@gmail.com" target="_blank">venefax@gmail.com</a>></span> wrote:<br></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">What would it be the right tar parameters to compress and decompress all the rootfs, including devices and special files?<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 4, 2015 at 11:58 AM, Bostjan Skufca <span dir="ltr"><<a href="mailto:bostjan@a2o.si" target="_blank">bostjan@a2o.si</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Depends if you need consistent copy and how much downtime you can tolerate.<div><br></div><div>If inconsistent copy is enough, then you can run rsync over storage of running container (on host, not in container) and be done with it.</div><div><br></div><div>Rsync:</div><div>I find rsync useful and fast, providing that:</div><div>- whole container filesystem metadata fits into memory</div><div>- not too much data changes between subsequent rsync runs</div><div><br></div><div>So, my simplified procedure is:</div><div>1: rsync #1 - does most of the work, takes time, but can be run on running container</div><div>2: rsync #2 - to see how much files have changed since initial run (gives good estimate of upcoming downtime)</div><div>3: lxc-stop -n container (on host 1)</div><div>4: rsync #3</div><div>5: lxc-start -n container (on host 2)</div><div><br></div><div>This procedure gives me about 10 seconds of downtime for containers with small filesystems (up to 50GB).</div><div><br></div><div>Block device migration:</div><div>Rsync is fast if it operates on not-too-many-files. If you are getting long rsync runs because of amount of small files, then you might be better off migrating whole block device. You can go about it with LVM or btrfs snapshots too. I do not usually use this.</div><div><br></div><div><br></div><div>LXC vs LXD:</div><div>LXC in generally single-host-centred, so you have to do things manually.</div><div>LXD on the other hand supports operations on multiple hosts, but others are more qualified to summarize what is currently possible (creating LXD host associations between on-premises and cloud-provider hosts etc.)<span><font color="#888888"><br></font></span></div><span><font color="#888888"><div><br></div><div>b.</div><div><br></div><div><br></div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On 4 December 2015 at 17:32, Saint Michael <span dir="ltr"><<a href="mailto:venefax@gmail.com" target="_blank">venefax@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">I was going t ask the same question.<br></div><div class="gmail_default" style="font-size:small">It  is a very important one. I am moving containers via rsync, but it takes tooo long.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 4, 2015 at 11:03 AM, Eax Melanhovich <span dir="ltr"><<a href="mailto:afiskon@devzen.ru" target="_blank">afiskon@devzen.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello.<br>
<br>
Lets say I have some container. I would like to run something like:<br>
<br>
lxc-backup -n test-container my-backup.tgz<br>
<br>
Then move backup somewhere (say, to Amazon S3). Then say I would like<br>
to restore my container or create its copy on different machine. So I<br>
need something like:<br>
<br>
lxc-restore -n copy-of-container my-backup.tgz<br>
<br>
I discovered lxc-snapshot, but it doesn't do exactly what I need.<br>
<br>
So what is the right way of backuping and restoring linux containers?<span><font color="#888888"><br>
<span><font color="#888888"><br>
--<br>
Best regards,<br>
Eax Melanhovich<br>
<a href="http://eax.me/" rel="noreferrer" target="_blank">http://eax.me/</a><br>
_______________________________________________<br>
lxc-users mailing list<br>
<a href="mailto:lxc-users@lists.linuxcontainers.org" target="_blank">lxc-users@lists.linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a></font></span></font></span></blockquote></div><br></div>
<br>_______________________________________________<br>
lxc-users mailing list<br>
<a href="mailto:lxc-users@lists.linuxcontainers.org" target="_blank">lxc-users@lists.linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a><br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
lxc-users mailing list<br>
<a href="mailto:lxc-users@lists.linuxcontainers.org" target="_blank">lxc-users@lists.linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a><br></blockquote></div><br></div>
<br>_______________________________________________<br>
lxc-users mailing list<br>
<a href="mailto:lxc-users@lists.linuxcontainers.org" target="_blank">lxc-users@lists.linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a><br></blockquote></div></div>
_______________________________________________<br>
lxc-users mailing list<br>
<a href="mailto:lxc-users@lists.linuxcontainers.org" target="_blank">lxc-users@lists.linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a></blockquote></div>
</div></div><br>_______________________________________________<br>
lxc-users mailing list<br>
<a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-users</a><br></blockquote></div><br></div>