<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jun 27, 2014 at 9:28 AM, Qiang Huang <span dir="ltr"><<a href="mailto:h.huangqiang@huawei.com" target="_blank">h.huangqiang@huawei.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">On 2014/3/16 17:07, Guido Jäkel wrote:<br>
> ... or use an image file on an abitrary file system on the host. Just create<br>
> a file containing a filesystem and use it direct (no loop device required) as<br>
> rootfs for the container.<br>
><br>
> Guido<br>
<br>
</div>Hi Guido,<br>
<br>
Can you be more specific about how to use a image file to limit disk size<br>
but with no loop device?<br>
<br>
All I know is something like this:<br>
# dd if=/dev/zero of=lxc.img bs=1M count=0 seek=40960<br>
# mkfs.ext3 lxc.img<br>
# mount -o loop lxc.img /lxc_container1/ # here we need loop device<br>
# cp -r /template1/rootfs/* /lxc_container1/<br>
<br></blockquote><div><br></div><div>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.</div>
<div><br></div><div>From "man lxc.container.conf"<br></div><div><br></div><div>...</div><div><div>lxc.rootfs</div><div>...<br></div><div>loop:/file tells lxc to attach /file to a loop device and mount the loop device.</div>
</div><div><br></div><div><br></div><div>... and from "man lxc-create"</div><div>-B backingstore<br></div><div><div>'backingstore' is one of 'dir', 'lvm', 'loop', 'btrfs', or 'best'.</div>
<div><br></div></div><div>-- </div><div>Fajar</div><div><br></div><div><br></div><div><br></div><div><br></div></div></div></div>