[lxc-users] Args for lxd init via script

Fajar A. Nugraha list at fajar.net
Mon May 22 03:55:47 UTC 2017


On Mon, May 22, 2017 at 10:25 AM, Mark Constable <markc at renta.net> wrote:

> On 5/22/17 12:28 PM, Fajar A. Nugraha wrote:
>
>> Yes but I also want the current disk usage to be available inside
>>> the container so that, for instance, df returns realistic results.
>>>
>>
>> Have you tried lxd with zfs?
>>
>
> Yes, zfs (pool per container) is what I am currently using here...
>
> https://raw.githubusercontent.com/netserva/sh/master/bin/setup-lxd
>
>

Ah, so you create a new storage profile, with its own pool, for each plan?

from your script:
lxc storage create "zfs$_HOST$VSIZE" zfs size=$VSIZE

That would create a zfs pool backed by loopback file on /var/lib/lxd/disks/
. NOT a good setup, performance-wise.



> Did you mean zfs dataset?
>>
>
> Is that the same thing as a "volume" (as seen by lxd) ?
>
>
zfs dataset is the equivalent of btrfs subvolume

Using a default zfs pool, and having separate DATASET (or to be more
>> accurate, filesystem) per container, is the default setup. Which
>> would provide correct disk usage statistic (e.g. for "df" and such).
>>
>
> I did try something with "volumes" but I got the impression it did not
> seem to provide correct "df"


subvolume with btrfs does not provide correct df.
zfs dataset provide correct df.


> results but I was floundering around just
> trying to get anything to work (with df) at the time.
>
> And it's perfectly normal to have several hundred or thousand dataset
>> (which would include snapshots as well) on a single pool.
>>
>
> And I'd imagine copying and moving containers would make more sense.
>
>
Correct.
Simply create ONE storage pool, the default (part of lxd init). If you want
to create multiple profile, attach that same pool to the profile. Then for
each container, lxd will automatically create a dataset for that container.
And when there's only one pool, container creation (from image), snapshot,
and copy would be instaneous.

If you want better performance, create the pool manually using block device
(preferably disk/partition, but an LV should also work), and pass the name
of the pool to lxd init.

-- 
Fajar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170522/ad92cb9f/attachment.html>


More information about the lxc-users mailing list