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

Fajar A. Nugraha list at fajar.net
Fri Jun 27 03:38:02 UTC 2014


On Fri, Jun 27, 2014 at 9:28 AM, Qiang Huang <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.

>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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20140627/e1d57ec6/attachment-0001.html>


More information about the lxc-users mailing list