[lxc-users] lxc config device add

Spike spike at drba.org
Tue Apr 18 15:05:16 UTC 2017


Hi,

I've just gone through this recently to expose a data/ partition and found
a bunch of docs with several different methodologies (and some scripted
utils):

- https://github.com/lxc/lxd/issues/2025 (explains the theory/problem)
- https://github.com/lxc/lxd/issues/2526
- https://gist.github.com/nottrobin/a66d3d5b9722149136d7fc6f93dae59f
 (Script)
- https://github.com/antitoine/lxd-functions
- https://gist.github.com/bloodearnest/ebf044476e70c4baee59c5000a10f4c8
(another
script)

for myself I arrived to the same conclusion as Sjoerd, the easiest thing
was to chown the dir on the host to match the uuid on the guest. If you
read the links above you'll understand the uuid mapping and by running ls
on the container's data you can double-check your root's uuid on the guest
(by default it should be 100000 on ubuntu). After a chown/chgrp root will
have access to it on the guest and will be able to further add dirs for
specific users. Do not that even root on the guest won't be able to chown
the folder itself so if you want the entire partition to be owned by mysql
you need to find mysql's uid and chown on the host to that.

hope that helps,

Spike

On Tue, Apr 18, 2017 at 4:59 AM Gabriel Marais <gabriel.j.marais at gmail.com>
wrote:

>
> >> I was trying to mount a block device where my mysql data would live.
> >> How do I go about changing the permissions/ownership?
> >
> > I guess the easiest is to change the uid/guid on the host to match the
> desired uid/gid in the container.
>
> Is there any pointer/doc on how to do that?
>
> >
> > Cheers,
> > Sjoerd
> > _______________________________________________
> > lxc-users mailing list
> > lxc-users at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-users
> >
>
> --
>
>
>
>
> Regards
>
> Gabriel Marais
>
> Office: +27 861 466 546 x 7001 <+27%2086%20146%206546>
> Mobile: +27 83 663 2222 <+27%2083%20663%202222>
> Mail: gabriel.j.marais at gmail.com
>
> Unit 11, Ground Floor, Berkley Office Park
> Cnr Bauhinia & Witch Hazel Str,
> Highveld, Centurion, South-Africa
> 0157
>
> PO Box 15846, Lyttelton, South Africa, 0140
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170418/90cd792d/attachment.html>


More information about the lxc-users mailing list