3

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

CiTuX
  • 131
  • 1
  • 3
  • care to elaborate a bit adding, for example, what have you tried so far, how did it fail, etc...? – dawud Aug 03 '13 at 11:12

1 Answers1

2

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)

Petter H
  • 3,443
  • 1
  • 16
  • 19
  • I've added more details in question. `mount: cannot remount block device rootfs read-write, is write-protected` Maybe AppArmor? – CiTuX Aug 03 '13 at 14:12
  • did you run `# quotacheck -cug /` ? I'm not too familiar with AppArmor, but it could be the culprit check the logs – Petter H Aug 04 '13 at 05:23