[Lxc-users] how to limit disk space in lxc
Serge Hallyn
serge.hallyn at canonical.com
Thu Oct 25 14:07:42 UTC 2012
Quoting Fajar A. Nugraha (list at fajar.net):
> On Thu, Oct 25, 2012 at 4:11 PM, 宣铭艺 <xuanmingyi at gmail.com> wrote:
> > Dear all:
> > The problem is that,how can we limit the disk space in lxc.Now I use the
> > default config.
> > And the container can access all space in host.can we use lvm or other tools
> > to limit it?
> > And how :)
>
> simplest solution: place the container rootfs in an LV.
>
> You need to create and format the LV and move the rootfs MANUALLY
> after the container is created though, as AFAIK no template has the
> ability to "create a rootfs in an LV of this size".
-B option to lxc-create specifies the backing store type.
sudo lxc-create -t ubuntu -B lvm -n u1
will default to 500M rootfs with ext4, or
sudo lxc-create -t ubuntu -B lvm -n u1 --fssize 2G --fstype xfs
-serge
More information about the lxc-users
mailing list