[lxc-users] Adding a second disk to a container

Christian Brauner christian.brauner at canonical.com
Thu Jul 13 10:27:53 UTC 2017


On Wed, Jul 12, 2017 at 04:25:54PM -0400, Stéphane Graber wrote:
> On Wed, Jul 12, 2017 at 01:44:13PM -0600, Joshua Schaeffer wrote:
> > I'm wondering what the best/recommended approach is to adding a second disk to a container. I'm using LXD 2.15 on Ubuntu 16.04. As an example I have a container where I've limited the disk size to 20GB:
> > 
> >     lxduser at blllxd01:~$ lxc config show bllcloudctl01 | grep -A 4 root
> >       root:
> >         path: /
> >         pool: int_lxd
> >         size: 20GB
> >         type: disk
> > 
> > This works great, but say I want the container to have another disk device that is mounted elsewhere like /mnt/disk1. I've tried adding that in my config but I alway get an error about needing the source. Since I'm using ZFS I don't have an actual block device to pass to the source. I then played around with storage volumes, which appears to work, but I always get an error when editing the volume:
> > 
> >     lxduser at blllxd01:~$ lxc storage volume create int_lxd vol1
> >     Storage volume cinder created
> > 
> >     lxduser at blllxd01:~$ lxc storage volume set int_lxd vol1 size=240GB
> >     error: ETag doesn't match: 834842d9406bd41f2f23c097e496434c3c263a022ef3fb1aaf214b13e4395771 vs b37ae1157f2a46dc1b24b2b561aefccc168ba822d5057330e94ca10ba47ccfb6
> 
> Sorry about that, looks like we're missing a test for "lxc storage
> volume set", I fixed the issue and added a test:
> 
> https://github.com/lxc/lxd/pull/3541
> 
> > If I create the storage volume with the size parameter is works, but doesn't set the right size:
> > 
> >     lxduser at blllxd01:~$ lxc storage volume delete int_lxd vol1
> >     Storage volume cinder deleted
> > 
> >     lxduser at blllxd01:~$ lxc storage volume create int_lxd vol1 size=240GB
> >     Storage volume cinder created
> > 
> >     lxduser at blllxd01:~$ lxc storage volume show int_lxd vol1
> >     config:
> >       *size: 10GB*
> >     description: ""
> >     name: vol1
> >     type: custom
> >     used_by: []
> 
> Hmm, so I'm not sure what's going on here. For container type volumes,

It was simple failure in the logic. If users passed a "size" property we parsed
and checked it but accidently set "size = 10GB" which obviously should've been
an else branch.

> we tie their size to the disk entry. But for custom volumes, we should
> very much be using the voluem size property for this since they can be
> shared with multiple containers.
> 
> So I would expect to both have the property applied at creation time
> (which it's not right now) and to allow the user to set the size
> afterwards so long as the backend permits it.

I agree. I'm looking into this right now (Also to make sure that I've not
already implemented this logic and just forgot.)

> 
> Christian, can you take care of this?

Do you need to ask? ;)

> 
> > I really just learned about storage volumes so I'm not even sure if I'm using them correctly or in the correct context here. Also, I get that ETag error whenever I edit the volume, even if I didn't make changes:
> > 
> >     lxduser at blllxd01:~$ lxc storage volume delete int_lxd vol1
> >     Storage volume cinder deleted
> > 
> >     lxduser at blllxd01:~$ lxc storage volume create int_lxd vol1
> >     Storage volume vol1 created
> > 
> >     lxduser at blllxd01:~$ lxc storage volume edit int_lxd vol1
> > /[I immediately exit the editor without making any changes]/
> >     Config parsing error: ETag doesn't match: 446844b3e6b6bc70d7a101b5b281e4cc8fb568cfcd66424f32b2027c8215032a vs 9e27a7a4de3badc96a0046c111094164619f7cfc6351534c7b7236769c85ace1
> >     Press enter to open the editor again
> > 
> > I just want the container to look like it has two disks, one mounted on / and the other mounted under /mnt.
> > 
> > Thanks,
> > Joshua Schaeffer
> > _______________________________________________
> > 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: 801 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170713/ba72deb7/attachment.sig>


More information about the lxc-users mailing list