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

Benoit GEORGELIN - Association Web4all benoit.georgelin at web4all.fr
Tue Jun 7 15:40:28 UTC 2016


Hi, 

thanks everyone . 
My concern is really inside the container 
BRTFS is managing the quota and it's working well 

btrfs qgroup show -pcre /var/lib/lxd/containers 
qgroupid rfer excl max_rfer max_excl parent child 
-------- ---- ---- -------- -------- ------ ----- 
0/5 433.75MiB 433.75MiB none none --- --- 
0/261 1.59GiB 1.59GiB none none --- --- 
0/264 315.33MiB 209.77MiB none none --- --- 
0/265 1.53GiB 1.43GiB none none --- --- 
0/333 989.68MiB 989.68MiB 10.00GiB none --- --- 
0/336 3.14GiB 3.14GiB 10.00GiB none --- --- 
0/384 562.26MiB 562.26MiB none none --- --- 
0/389 627.48MiB 627.48MiB none none --- --- 
0/390 361.76MiB 48.74MiB none none --- --- 
0/391 383.54MiB 70.52MiB 10.00GiB none --- --- 


But inside the container, you can see the disk information from the host, not the disk from the container :( 
The quota is set to 10Go 

df -h 
Filesystem Size Used Avail Use% Mounted on 
/dev/sdb 100G 10G 89G 11% / 
none 492K 0 492K 0% /dev 
/dev/sdb 100G 10G 89G 11% /dev/lxd 
cgroup_root 10M 0 10M 0% /sys/fs/cgroup 
udev 481M 0 481M 0% /dev/tty 
tmpfs 497M 0 497M 0% /dev/shm 
tmpfs 497M 6.3M 491M 2% /run 
tmpfs 5.0M 0 5.0M 0% /run/lock 


Cordialement, 

Benoît 


De: "Fajar A. Nugraha" <list at fajar.net> 
À: "lxc-users" <lxc-users at lists.linuxcontainers.org> 
Envoyé: Lundi 6 Juin 2016 00:58:18 
Objet: Re: [lxc-users] Real disk information inside container - Btrfs 

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 
_______________________________________________ 
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/20160607/31441d2a/attachment.html>


More information about the lxc-users mailing list