[lxc-users] Moving files to a guest fs from the host

Stéphane Graber stgraber at ubuntu.com
Thu Apr 4 16:50:14 UTC 2019


LXD only mounts the ZFS datasets when the container is started, so you should:
 - Set security.privileged to true
 - Start the container (or alternatively manually "zfs mount" it)
 - Rsync
 - Stop or unmount the container
 - Unset security.privileged
 - Start it

On Thu, Apr 04, 2019 at 10:42:38AM -0400, Brandon Whaley wrote:
> I'm in the middle of migrating some users from VZ to LXC/LXD with ZFS
> backed guest fs.  I'm using rsync with --numeric-ids to copy the files
> with the correct uid/gid to the container's private area.  It was
> suggested to me that I could get the uid/gid remapping done by making
> the destination container privileged and starting/stopping it before
> the xfer, which does appear to work from the host side.  Unfortunately
> after setting the container back to unprivileged mode and starting it,
> the new files are gone and the fs is back to its pre-rsync state.
> Setting the container to privileged mode again shows that the files
> are still there, just being hidden by some overlay.
> 
> I'm wondering if there is a mechanism to mount a non-uid/gid remapped
> guest fs that will not end up being overridden when the remapping is
> done.
> 
> root at atl-comp1:~# lxc config set instance-00000019 security.privileged false
> root at atl-comp1:~# lxc start instance-00000019
> root at atl-comp1:~# ls -hal
> /var/lib/lxd/storage-pools/default/containers/instance-00000019/rootfs/etc/redhat-release
> ls: cannot access
> '/var/lib/lxd/storage-pools/default/containers/instance-00000019/rootfs/etc/redhat-release':
> No such file or directory
> root at atl-comp1:~# lxc stop instance-00000019
> root at atl-comp1:~# lxc config set instance-00000019 security.privileged true
> root at atl-comp1:~# lxc start instance-00000019
> root at atl-comp1:~# ls -hal
> /var/lib/lxd/storage-pools/default/containers/instance-00000019/rootfs/etc/redhat-release
> ls: cannot access
> '/var/lib/lxd/storage-pools/default/containers/instance-00000019/rootfs/etc/redhat-release':
> No such file or directory
> root at atl-comp1:~# lxc stop instance-00000019
> root at atl-comp1:~# ls -hal
> /var/lib/lxd/storage-pools/default/containers/instance-00000019/rootfs/etc/redhat-release
> lrwxrwxrwx 1 root root 14 Apr  3 12:53
> /var/lib/lxd/storage-pools/default/containers/instance-00000019/rootfs/etc/redhat-release
> -> centos-release
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20190404/74f81168/attachment.sig>


More information about the lxc-users mailing list