[lxc-users] How to copy "manually" a container ?

Pierre Couderc pierre at couderc.eu
Thu Aug 23 10:36:37 UTC 2018


On 08/23/2018 12:14 PM, Fajar A. Nugraha wrote:
> On Thu, Aug 23, 2018 at 2:38 PM, Pierre Couderc <pierre at couderc.eu 
> <mailto:pierre at couderc.eu>> wrote:
>
>     On 08/23/2018 09:24 AM, Fajar A. Nugraha wrote:
>>     On Thu, Aug 23, 2018 at 2:07 PM, Pierre Couderc
>>     <pierre at couderc.eu <mailto:pierre at couderc.eu>> wrote:
>>
>>         On 08/23/2018 07:37 AM, Tamas Papp wrote:
>>
>>
>>             On 08/23/2018 05:36 AM, Pierre Couderc wrote:
>>
>>                 If for any reason, "lxc copy" does not work, is it
>>                 enough to copy (rsync) /var/lib/lxd/containers/xxxx
>>                 to another lxd on another computer in
>>                 /var/lib/lxd/containers/ ?
>>
>>
>>             Copy the folder (watch out rsync flags) to
>>             /var/lib/lxd/storage-pools/default/containers/, symlink
>>             to /var/lib/lxd/containers and run 'lxd import'.
>>
>>         Thank you very much. It nearlu worked.
>>         Anyway, it fails (in this case) because :
>>         Error: The storage pool's "default" driver "dir" conflicts
>>         with the driver "btrfs" recorded in the container's backup file
>>
>>
>>     If you know how lxd use btrfs to create the container storage
>>     (using subvolume?), you can probably create it manually, and
>>     rsync there.
>>
>>     Or you can create another storage pool, but backed by dir (e.g.
>>     'lxc storage create pool2 dir') instead of btrfs/zfs.
>>
>>     Or yet another way:
>>     - create a new container
>>     - take note where its storage is (e.g. by looking at mount
>>     options, "df -h", etc)
>>     - shutdown the container
>>     - replace the storage with the one you need to restore
>>
>>     -- 
>>     Fajar
>>
>     Thank you, I think to that.
>     But what is sure is that my "old" container is labelled as btrfs
>     and after rsync on a "non btrfs" volume, the btrfs label remains....
>
>
>
> You can edit backup.yaml to reflect the changes. Here's an example on 
> my system:
Fine, it was the missing point !
Thank you very much

> In the case of "copy" (instead of backup and restore) like in my case, 
> you'd want to change "volatile.eth0.hwaddr" too. Otherwise you'd end 
> up with multiple containers with the same MAC and IP address.
No need in my case : it is only a workaround as for some mistery, my 
"lxc copy" fails.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20180823/1c233145/attachment-0001.html>


More information about the lxc-users mailing list