quotas + jail ?

Michal Mertl michal.mertl at i.cz
Wed Jan 11 09:48:06 PST 2006


Marc G. Fournier wrote:
> On Wed, 11 Jan 2006, Michal Mertl wrote:
> 
> > Vladimir Dvorak wrote:
> >> Hello,
> >>
> >> I have simple question - is possible to use quotas in jail(8) environment ?
> >
> > Yes, it is, although with some restrictions.
> >
> > You have to enable the disk quotas from the host (have them listed in
> > host's /etc/fstab).
> >
> > To operate the quotas from inside the jail quotas have to be mentioned
> > in jail's /etc/fstab too (when using the file name of quota file it has
> > to be relative to jail's root). Repquota/edquota/quota work inside the
> > jail.
> >
> > You have to keep in mind that disk quotas are in fact a property of a
> > filesystem and are not related to jails at all. So if two jails share a
> > filesystem the disk quotas are shared too. If you have users with the
> > same UID in both the jails they will share the quota.
> 
> How hard would it be to extend quotas so that its not just uid/gid based, 
> but directory?  ie. everything under /vm/jail1 falls under this quota, 
> regardless of uid/gid?

I don't think I understand your goal. Do you want some grand limit for
whole jail's disk usage or have separated quotas for jails on the same
partition?

Neither can be done at the moment with disk quotas. The needed changes
to support either will be quite extensive I believe.

I recommend using separate partition for each jail. This will allow you
to achieve both goals at the same time. If you have lot of jails and the
number of partitions is the problem you can use gpt(8) or vnode based
md(4) (see mdconfig(8)). With md(4) you can also use sparse backing
files and that way have more space than you have on physical drives.

Beware of overcommit though - I wouldn't be surprised if the system
crashed when the disk is full and the md(4) file system is supposed to
have free space in it.

Michal




More information about the freebsd-questions mailing list