[lxc-users] Setting a limit on the disk size that a container can use

Qiang Huang h.huangqiang at huawei.com
Fri Jun 27 02:28:40 UTC 2014


On 2014/3/16 17:07, Guido Jäkel wrote:
> ... or use an image file on an abitrary file system on the host. Just create
> a file containing a filesystem and use it direct (no loop device required) as
> rootfs for the container.
> 
> Guido

Hi Guido,

Can you be more specific about how to use a image file to limit disk size
but with no loop device?

All I know is something like this:
# dd if=/dev/zero of=lxc.img bs=1M count=0 seek=40960
# mkfs.ext3 lxc.img
# mount -o loop lxc.img /lxc_container1/       # here we need loop device
# cp -r /template1/rootfs/* /lxc_container1/

Thanks!
Qiang

> 
> On 2014-03-16 07:26, Tamas Papp wrote:
>>
>> On 03/16/2014 06:01 AM, David Shwatrz wrote:
>>> Hello,
>>> What is the best way to set a limit on the disk size that a container
>>> root filesystem can use ?
>>
>> Either use partition (or zfs/btrfs fisystems and volumes) or run
>> containers as unprivileged users + quota.
>>
>>
>> tamas
> 
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
> 
> 




More information about the lxc-users mailing list