[Lxc-users] disk limit?
Serge Hallyn
serge.hallyn at canonical.com
Wed May 18 18:59:54 UTC 2011
Quoting Corin Langosch (corinl at gmx.de):
> On 18.05.2011 17:52, Serge Hallyn wrote:
> >
> >Why do you call it not easy? Because you don't have spare partitions to
> >dedicate to a pv? Or because you're not used to using lvm?
> >
> >If the former, then you could use a loopback filesystem instead of
> >an LVM. I assume that'll impact performance, but I've not tested it
> >to see by how much.
> >
> >If the latter, then in the next few months I intend to push some
> >stuff to lxc to integrate LVM usage. Daniel had had comments to
> >my first patches so it'll likely change, but what I'm using right
> >now let's me just do lxc-lvmcreate in place of lxc-create to create
> >a lvm-backed lxc partition, and 'lxc-clone -s -o c1 -n c2' lets me
> >create container c2 with a lvm snapshot of c1's rootfs.
> >(See http://s3hh.wordpress.com/2011/03/30/lxc-lvm-clone/ and
> >http://s3hh.wordpress.com/2011/03/30/one-more-lxc-clone-update/)
> >
> >There's no cgroup to do what you want, though.
> >
> >
> I might be wrong, but I think the biggest disadvantage
> (show-stopper) of lvm/ loopback is that the partition/ image will
Certainly not for loopback. Just make sure to create it as having
a big hole in the middle, something like
dd if=/dev/zero of=/srv/container1.rootfs.img bs=1M skip=10000 count=1
However, if the container fills a 1G file and then deletes it, that
space won't be freed.
For LVM volumes, you can create one canonical container which takes
up the space, then create other containers as snapshots of it. The
snapshot containers won't take up space until the container starts
changing blocks.
I'm not saying I don't see the advantage of what you want :) Just
trying to give options.
Once user namespaces are complete there may be one more option -
create a separate user on the host for each container. Start the
container as that user. And give that user the quota you want to
enforce. But that's a ways away.
> consume the whole space even when not a single file is actually
> stored in the fs. For example imagine you have a 500 GB hardisk and
> want to create 50 vservers with an 50 GB diskspace limit each. This
> is not possible with lvm or loopback devices because one would need
> 2500 GB storage. But it's a very common use case because in average
> only 5% of the vservers will actually use 50GB and so you'll never
> run out of space if the space would be allocated on demand.
>
> Corin
>
More information about the lxc-users
mailing list