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

Stéphane Graber stgraber at ubuntu.com
Wed Jul 12 20:25:54 UTC 2017


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,
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.

Christian, can you take care of this?

> 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/20170712/d9d25ada/attachment.sig>


More information about the lxc-users mailing list