[lxc-users] LXD move container to another pool ?

2018-08-09 Thread Pierre Couderc

I want to "format"  my LXD  computer   :

So I would like to  :

- create a LXD storage on an auxiliary (btrfs) disk, something like : 
lxd storage create mytmp btrfs source=/mnt/my_btrfs_unit/lxd_subvolume 
(is this possible ?)


- move my contianer to this new storage . How ?

- fulley reinstall my server and LXD

- "attach" my /mnt/my_btrfs_unit/lxd_subvolume to new LXD (how ?)

- move back my container

- detach and remove my tmp subvolume


If it was on another computer it would be a simple "move"...

Thanks

PC



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

Re: [lxc-users] LXD move container to another pool ?

2018-08-09 Thread Fajar A. Nugraha
On Thu, Aug 9, 2018 at 4:11 PM, Pierre Couderc  wrote:

> I want to "format"  my LXD  computer   :
>
> So I would like to  :
>
> - create a LXD storage on an auxiliary (btrfs) disk, something like : lxd
> storage create mytmp btrfs source=/mnt/my_btrfs_unit/lxd_subvolume (is
> this possible ?)
>
> - move my contianer to this new storage . How ?
>
> - fulley reinstall my server and LXD
>
> - "attach" my /mnt/my_btrfs_unit/lxd_subvolume to new LXD (how ?)
>
> - move back my container
>
> - detach and remove my tmp subvolume
>
>
> If it was on another computer it would be a simple "move"...
>
>
So basically you just want to backup and restore the complete lxd setup?
What are you currently using?

Basically you'd just need to copy /var/lib/lxd and whatever storage backend
you use (I use zfs), and then copy them back later. Since I also put
/var/lib/lxd on zfs (this is a custom setup), I simply need to
export-import my pool.

If you currently use the default zfs-on-loopback backend, you simply need
to copy /var/lib/lxd and the loopback file (I don't remember the name
offhand). If you use btrfs, then the easiest way is to detach the disk
before formatting the pool (plus copy /var/lib/lxd, obviously).

"Moving" a container to a new storage is, AFAIK, a more complicated
process. The only way I know of is basically create a container on that new
pool, and overwrite the content of its rootfs. I don't recommend this for
your particular needs.

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

Re: [lxc-users] LXD move container to another pool ?

2018-08-09 Thread Pierre Couderc

Thank you very much, I think this is the good way !


On 08/09/2018 11:30 AM, Fajar A. Nugraha wrote:
On Thu, Aug 9, 2018 at 4:11 PM, Pierre Couderc > wrote:


I want to "format"  my LXD  computer   :

So I would like to  :

- create a LXD storage on an auxiliary (btrfs) disk, something
like : lxd storage create mytmp btrfs
source=/mnt/my_btrfs_unit/lxd_subvolume (is this possible ?)

- move my contianer to this new storage . How ?

- fulley reinstall my server and LXD

- "attach" my /mnt/my_btrfs_unit/lxd_subvolume to new LXD (how ?)

- move back my container

- detach and remove my tmp subvolume


If it was on another computer it would be a simple "move"...


So basically you just want to backup and restore the complete lxd 
setup? What are you currently using?


Basically you'd just need to copy /var/lib/lxd and whatever storage 
backend you use (I use zfs), and then copy them back later. Since I 
also put /var/lib/lxd on zfs (this is a custom setup), I simply need 
to export-import my pool.


If you currently use the default zfs-on-loopback backend, you simply 
need to copy /var/lib/lxd and the loopback file (I don't remember the 
name offhand). If you use btrfs, then the easiest way is to detach the 
disk before formatting the pool (plus copy /var/lib/lxd, obviously).


"Moving" a container to a new storage is, AFAIK, a more complicated 
process. The only way I know of is basically create a container on 
that new pool, and overwrite the content of its rootfs. I don't 
recommend this for your particular needs.


--
Fajar


___
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

Re: [lxc-users] LXD move container to another pool ?

2018-08-09 Thread Pierre Couderc


On 08/09/2018 11:30 AM, Fajar A. Nugraha wrote:


Basically you'd just need to copy /var/lib/lxd and whatever storage 
backend you use (I use zfs), and then copy them back later. Since I 
also put /var/lib/lxd on zfs (this is a custom setup), I simply need 
to export-import my pool.




/var/lib/lxc alone, nothing about /var/lxc ?

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

Re: [lxc-users] LXD move container to another pool ?

2018-08-09 Thread Fajar A. Nugraha
On Thu, Aug 9, 2018 at 7:57 PM, Pierre Couderc  wrote:

>
> On 08/09/2018 11:30 AM, Fajar A. Nugraha wrote:
>
>
> Basically you'd just need to copy /var/lib/lxd and whatever storage
> backend you use (I use zfs), and then copy them back later. Since I also
> put /var/lib/lxd on zfs (this is a custom setup), I simply need to
> export-import my pool.
>
>
> /var/lib/lxc alone, nothing about /var/lxc ?
>
>
>
Are you using lxc1 (e.g. lxc-create commands) or lxd?

When lxd is installed as package (e.g. installed as apt on ubuntu), you
only need /var/lib/lxd and its storage pool (which will be mounted
on /var/lib/lxd/storage-pools/...).

Here's what I'm using:
- I start AWS spot instance
- I have a custom ubuntu template, with lxd installed but not started. It
thus has an empty /var/lib/lxd,  with no storage pools and network.
- I have a separate EBS disk, used by a zfs pool 'data'. I then have
'data/lib/lxd' which I mount as '/var/lib/lxd', and 'data/lxd' which is
registered as lxd storage pool 'default'.
- I create containers (using that default pool)
- if that spot instance is terminated (thus the "root"/OS disk is lost), I
can simply create a new spot instance again, and attach the 'data' pool
there. I will then have access to all my containers.

Is that similar to what you need?

Note that lxc1 and lxd from snap uses different directories than lxd from
package.

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

Re: [lxc-users] LXD move container to another pool ?

2018-08-10 Thread Pierre Couderc



On 08/10/2018 05:27 AM, Fajar A. Nugraha wrote:
On Thu, Aug 9, 2018 at 7:57 PM, Pierre Couderc > wrote:



On 08/09/2018 11:30 AM, Fajar A. Nugraha wrote:


Basically you'd just need to copy /var/lib/lxd and whatever
storage backend you use (I use zfs), and then copy them back
later. Since I also put /var/lib/lxd on zfs (this is a custom
setup), I simply need to export-import my pool.



/var/lib/lxc alone, nothing about /var/lxc ?



Are you using lxc1 (e.g. lxc-create commands) or lxd?

When lxd is installed as package (e.g. installed as apt on ubuntu), 
you only need /var/lib/lxd and its storage pool (which will be mounted 
on /var/lib/lxd/storage-pools/...).


Here's what I'm using:
- I start AWS spot instance
- I have a custom ubuntu template, with lxd installed but not started. 
It thus has an empty /var/lib/lxd,  with no storage pools and network.
- I have a separate EBS disk, used by a zfs pool 'data'. I then have 
'data/lib/lxd' which I mount as '/var/lib/lxd', and 'data/lxd' which 
is registered as lxd storage pool 'default'.

- I create containers (using that default pool)
- if that spot instance is terminated (thus the "root"/OS disk is 
lost), I can simply create a new spot instance again, and attach the 
'data' pool there. I will then have access to all my containers.

ok, fine


Is that similar to what you need?

Yes, this is very similar. Thank you.


Note that lxc1 and lxd from snap uses different directories than lxd 
from package.



Sorry for the noise : I use lxd (from sources on debian), and I had not 
seen that /var/lib/lxc exits but is empty...


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

Re: [lxc-users] LXD move container to another pool ?

2018-08-10 Thread Mark Constable

On 10/08/18 17:20, Pierre Couderc wrote:

Note that lxc1 and lxd from snap uses different directories than
lxd from package.


Sorry for the noise : I use lxd (from sources on debian), and I had
not seen that /var/lib/lxc exits but is empty...


FWIW /var/lib/lxc != /var/lib/lxd
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] LXD move container to another pool ? (updated)

2018-08-09 Thread Pierre Couderc


On 08/09/2018 11:30 AM, Fajar A. Nugraha wrote:


Basically you'd just need to copy /var/lib/lxd and whatever storage 
backend you use (I use zfs), and then copy them back later. Since I 
also put /var/lib/lxd on zfs (this is a custom setup), I simply need 
to export-import my pool.




/var/lib/lxc alone, nothing about /var/lib/lxc ?

___
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