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

Fajar A. Nugraha list at fajar.net
Thu Aug 9 09:30:15 UTC 2018


On Thu, Aug 9, 2018 at 4:11 PM, Pierre Couderc <pierre at couderc.eu> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20180809/db917573/attachment.html>


More information about the lxc-users mailing list