[lxc-users] Real disk information inside container - Btrfs

Fajar A. Nugraha list at fajar.net
Mon Jun 6 04:58:18 UTC 2016


On Sun, Jun 5, 2016 at 10:37 PM, Benoit GEORGELIN - Association
Web4all <benoit.georgelin at web4all.fr> wrote:
> Hi ,
> I was wondering if the real disk information and usage will be one day
> inside the container or if this is technically not possible ?
> So far, using Btrfs with a subvolume , quotas are working like a charm but
> inside the container, disk information and usage are those of the host.
> I guess it's the same with ZFS.

What do you mean "disk information and usage"? "df -h"?

> The only ways I figured to have the right space usage inside the container
> is to work with LVM, make a dedicated vg and use it with the container.


I'm going to use zfs as an example here, because that is what I use.

If you use zfs, and you use quota (via "size" property,
https://github.com/lxc/lxd/blob/master/doc/configuration.md#type-disk),
"df -h" on a new container should ALMOST show the correct usage,
except for the fact that "Avail" is what you set earlier in lxc
config, and "Size" is slightly larger. That is because some things in
the new container does not really use additional space, since it's a
clone of the template. So you ended up with a "virtual disk" that is
slightly larger than what you specified.

If you want "Size" from the output from "df -h" to exactly match the
"size" you set in lxc config, you can manually do someting like this

zfs set refquota=10G pool/lxd/containers/container_name

refquota counts everything "used" by the container, even cloned space.
So again, if your main concern is "df -h" output, then zfs can give
you correct info, with this additional manual setup.

I'm not familiar enough with btrfs to know whether "refquota" is also
possible on btrfs
(http://www.seedsofgenius.net/solaris/zfs-vs-btrfs-a-reference says
"no", but it might be an old document). Asking on btrfs list would
probably get you better answer on this.

-- 
Fajar


More information about the lxc-users mailing list