[lxc-users] Setting a limit on the disk size that a container can use
Qiang Huang
h.huangqiang at huawei.com
Fri Jun 27 04:02:39 UTC 2014
On 2014/6/27 11:38, Fajar A. Nugraha wrote:
> On Fri, Jun 27, 2014 at 9:28 AM, Qiang Huang <h.huangqiang at huawei.com <mailto:h.huangqiang at huawei.com>> wrote:
>
> 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/
>
>
> I'm pretty sure you still need loop device support. However you don't have to allocate the loop device or mount the image manually, you can just pass the image file name in lxc config file.
>
Yes, that's what I thought, seems like loop device is the only way to use image file
to limit disk. But I found some problems using loop device, wounding if we can
skip loop device, then I found Guido's mail.
cc Guido in case he really have something new.
> From "man lxc.container.conf"
>
> ...
> lxc.rootfs
> ...
> loop:/file tells lxc to attach /file to a loop device and mount the loop device.
>
>
> ... and from "man lxc-create"
> -B backingstore
> 'backingstore' is one of 'dir', 'lvm', 'loop', 'btrfs', or 'best'.
>
> --
> Fajar
>
>
>
>
>
>
> _______________________________________________
> 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