Re: [lxc-users] lxc archive / lxc restore command?

2017-04-13 Thread Serge E. Hallyn
Quoting Micky Del Favero (mi...@mesina.net):
> Tomasz Chmielewski  writes:
> 
> > In other words - how to best achieve:
> >
> > - tar a selected container
> >
> > - copy it via SSH somewhere
> >
> > - restore at some later point in time somewhere else, on a different,
> > unrelated LXD server
> 
> Probably it's not the best way to do it, but you can create an
> image starting from the container to be archive, export it to a tar
> archive and then destroy the image:
> 
>   $ lxc publish $container --alias $container

... That's how I usually do this.
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] lxc archive / lxc restore command?

2017-04-13 Thread Micky Del Favero
Tomasz Chmielewski  writes:

> In other words - how to best achieve:
>
> - tar a selected container
>
> - copy it via SSH somewhere
>
> - restore at some later point in time somewhere else, on a different,
> unrelated LXD server

Probably it's not the best way to do it, but you can create an
image starting from the container to be archive, export it to a tar
archive and then destroy the image:

  $ lxc publish $container --alias $container
  $ lxc image export $container
  $ lxc image delete $container

to restore it do the opposite:

  $ lxc image import $container.tar.gz
  $ lxc init $container $container
  $ lxc image delete $container
  
creating an image require to stop the container, so you cannot do it on
the fly.

In a simpler and faster (at least for me) way I achieve this goal simply
do manually a tar of /var/lib/lxd/containers/$container, when I'll need
to restore it I'll init a simple container: lxc init $smallimage
$container and then overwrite it with previously tarred container.

If container's filesystem is in a LV volume mount it somewhere and then
using tar on it, or snapshot the LV and then archive the snapshot.

Ciao, Micky
-- 
The sysadmin has all the answers, expecially "No"
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] lxc archive / lxc restore command?

2017-04-13 Thread Tomasz Chmielewski

It might work, but looks like an overkill to me.

Essentially, I want to do:

- full container backup - then restore it, perhaps somewhere else, at 
some point in the future


Can I simply copy /var/lib/lxd/containers/MYCONTAINER to a different 
server an expect it to work? I think it won't work, as lxd maintains its 
database, and if I just copy the container, it won't modify the 
database.



- archive the container and use it in a physically different network

Meaning, one LXD server not able to access the other in any way.



I know I can just create a new container on the destination, stop it, 
then replace "rootfs" with the one from the source system. But it also 
doesn't look "nice enough".



And, we loose any container settings set with all above approaches.


Tomasz Chmielewski
https://lxadm.com





On 2017-04-13 21:28, Ron Kelley wrote:

What about “lxc publish”?  That should allow you to publish your
container as an image to your local repository.  Then, you can
probably use the “lxc image” command to pull it from your repository
and start it.




On Apr 13, 2017, at 8:22 AM, Tomasz Chmielewski  
wrote:


Is there such a thing like "lxc archive / lxc restore"? Or perhaps 
"lxc export / lxc import"?



I have a container called "mycontainer". I would like to "archive" it, 
and save to backup.


Then, perhaps a month later, I would like to restore it, on a 
different LXD server.



Right now, the closest command I see there is is "lxc copy".

Unfortunately it requires:

- the copying part needs to be done "now"

- at least one server needs to be able to manage the other server (lxc 
remote)



In other words - how to best achieve:

- tar a selected container

- copy it via SSH somewhere

- restore at some later point in time somewhere else, on a different, 
unrelated LXD server




Tomasz Chmielewski
https://lxadm.com
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users


___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users