Disk quota inside LXC container.

Roman

Member
May 15, 2014
14
1
23
France, Nice
Hello,

I added
lxc.rootfs.options = grpquota,usrquota
to /etc/pve/lxc/100.conf

But no success:

Code:
[root@haugen /]# mount | grep 'on / '
/images/421/vm-421-disk-1.raw on / type ext4 (rw,relatime,quota,usrquota,grpquota,data=ordered)

[root@haugen /]# quotacheck -gum /
quotacheck: Cannot stat() mounted device /dev/loop4: No such file or directory
quotacheck: Mountpoint (or device) / not found or has no quota enabled.
quotacheck: Cannot find filesystem to check or filesystem not mounted with quota option.

Is it possible to enable quota?

Thanks
 
currently not. There is already an open bug report for that issue

https://bugzilla.proxmox.com/show_bug.cgi?id=782

Thanks for your reply.

But quota can works with this?

Code:
I added the following to the container config:
lxc.rootfs.options: usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0

Then started the container:

Inside the container I needed to create the / device node:

mknod /dev/loop0 b 7 0

Then the following commands succeed:

touch /aquota.user
touch /aquota.group

chmod 0600 /aquota.user 
chmod 0600 /aquota.group

quotacheck -cmug /

quotaon /

in my case ct mounts with /dev/loop4
 
I made a simple script, to workaround at this time, that starts at boot

Code:
[root@mark]# cat /etc/systemd/system/enablequota.service
[Unit]
Description=Enable Quota Fix

[Service]
ExecStart=/usr/bin/enable_quota

[Install]
WantedBy=multi-user.target

[root@mark]# cat /usr/bin/enable_quota
#!bin/bash
LOOP=`df  -l | grep -E -o "^/dev/loop.{0,1}"`
mknod $LOOP b 7 ${LOOP#'/dev/loop'}
 
Last edited:
Hi,

I performed as guide but quotas remain inactive

pct stop 103
edit /etc/pve/lxc/103.conf and add to bottom

lxc.rootfs.options: usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0

pct start 103
pct enter 103

mknod /dev/loop3 b 7 0
touch /aquota.user
touch /aquota.group

chmod 0600 /aquota.user
chmod 0600 /aquota.group

quotacheck -cmug /

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

try:
mount -o remount /
mount: cannot remount block device /dev/root read-write, is write-protected

my /etc/fstab is:
/dev/root / rootfs defaults 0 0

please help me.
thanks
 
First of all,

If i am not wrong, /dev/loop number 3 is not related to container number. It depends of containers boot order and which loop device is free in this order, if you boot machines in random order for example.

So, you need to check your loop device that mounted on / inside of your lxc container:

df -l | grep loop

If you have /dev/loop3 in this case, the minor number (device number within the group) for mknod will be 3, so:

mknod /dev/loop3 b 7 3
 
Last edited:
  • Like
Reactions: redpid
hello,

I've seen work well on 4.0 but I have upgraded to 4.1 PVE system. that is not working.
and i checked /etc/mtab
/dev/loop2 / ext4 rw,relatime,data=ordered 0 0
did not have
usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0
i don't know why.

my config

# Allow any mknod (but not using the node)
console: 0
cpulimit: 4
cpuunits: 1024
hostname: srv2.abc.com
memory: 4196
net0: bridge=vmbr0,gw=123.123.123.123,hwaddr=B2:BF:37:27:10:1D,ip=123.x.x.x/26,name=eth0,type=veth
ostype: centos
rootfs: local:103/vm-103-disk-1.raw,size=70G
swap: 4196
lxc.rootfs.options: usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0
 
Last edited:
Will user quotas ever be possible in LXC containers? If I need them in the future will they work on ZFS or should I be using ext4?
 
Same problem after update. I host containers with multiple user for web hosting purpose on Proxmox 3 and i d'like to migrate to Proxmox 4. I use XFS for pve-data
Last thing that block me to migrate is users quotas.
 
Added a comment.
PS: The GUI will soon(-ish) have a checkbox for that in the mount point editing panel. (pve-manager >= 4.1-16 iirc)
 
  • Like
Reactions: Roman
pve-container>=1.0-44, so yes
 
hello @wbumiller

"This only works for ext4-based containers, not with zfs subvolumes."

and for ZFS ?

thanks
Currently only zvols as they get an ext4 file system, but for subvolumes we haven't implemented anything yet. You can currently only set those from the host (eg. `# zfs set userquota@1000=4G /tank/subvol-400-disk-1`...)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!