LXC – quota inside container

lxcquota

Is it possible to use disk quota inside a LXC container?

I'm using LVM (ext4) as rootfs for the container. I don't now how to add the mount options to /etc/fstab properly.

The /etc/fstab of the container:


rootfs / rootfs rw,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0 0 0

This is what quotacheck -cug / returns:

quotacheck: Mountpoint (or device) / not found or has no quota enabled.
quotacheck: Cannot find filesystem to check or filesystem not mounted with quota option.

Output of mount:

http://pastebin.com/33AF62pu

Best Answer

Assuming your root file system is formatted in a file system with quota support, like ext3 or ext4, add usrquota,grpquota to /etc/fstab entry under options section (fourth field), and then run (assuming / is the file system mount point)

mount -o remount /

This assumes there is a separate file system for each LXC instance, else all instances sharing the same file system will be affected.

Make sure that the quota program is installed (how this is done varies depending on your OS version)