If the '/home' folder is a bind mount from a file system that has quotas enabled, Virtualmin 'Re-Check Configuration' erroneously reports that '/home' does not have quotas enabled, and disables setting quotas. Details below.
*Q: Is it possible to work around this? E.g. can you override the path used by Virtualmin for setting/checking quotas?*
To recreate this problem you can use this (artificial) example:
1) mv /home /homereal
2) mkdir /home
3) mount --bind /homereal /home
4) Log into Virtualmin and run 'System Settings' -> 'Re-Check Configuration'
5) Note that message is displayed: 'Quotas are not enabled on the filesystem /home which contains home directories under /home and email files under /home. Quota editing has been disabled.'
Tested on Virtualmin 4.10.gpl and Debian 7.
In a real example on Debian 7, /etc/fstab contains:
/dev/mapper/hosting /var/hosting ext4 barrier=1,data=ordered,relatime,grpquota,user_xattr,usrquota,rw 0 0
/var/hosting/home /home none bind 0 0
and mtab contains:
/dev/mapper/hosting /var/hosting ext4 rw,relatime,user_xattr,barrier=1,data=ordered,usrquota,grpquota 0 0
/dev/mapper/hosting /home ext4 rw,relatime,user_xattr,barrier=1,data=ordered,usrquota,grpquota 0 0
The command line quota tools work fine, but correctly report and operate on '/var/hosting' and not '/home'
/var/hosting/aquota.user
/var/hosting/aquota.group
Virtualmin/Webmin's checking algorithm and possibly quota operations don't seem aware of bind mounts. This could be fixed if 'findmnt' were used.
This might be a result of a deliberate change in Debian, where /etc/mtab is now a soft link to /proc/mount and now the 'bind' option is not listed in mtab.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=691151
It is recommended that the 'findmnt' command be used to find the correct source filesystem of a mount. And that works fine:
# findmnt /home
TARGET SOURCE FSTYPE OPTIONS
/home /dev/mapper/hosting[/home] ext4 rw,relatime,user_xattr,barrier=1,data=ordered,usrquota,grpquota
or if you want the correct path to set/check quotas in a script (this works equally well for bind and non-bind mount points)
# findmnt -vno target -s `findmnt -vno source /home`
/var/hosting
Until this is fixed, is it possible to work around this, e.g. can you override the path used by Virtualmin for setting/checking quotas?
Comments
Submitted by JamieCameron on Fri, 09/19/2014 - 14:51 Comment #1
This is tricky - handling it properly would presumably mean editing quotas on the real filesystem, not on /home.
Or in the case of bind mounts, can you use quota commands like edquota on the /home directory?
Submitted by aaronroydhouse on Mon, 09/22/2014 - 12:35 Comment #2
I don't this bug it is too tricky to fix, since 'findmnt' can do all the work.
Somewhere in Virtualmin it is already working out whether '/' or '/home' is the filesystem on which to edit quotas. This code mistakenly assumes that a mount point is always a device, which hasn't been the case since the 2.4 kernel more the a decade ago ;-)
That code just needs to map the mount point it to the actual device with 'findmnt'.
Without 'findmnt', the wrong thing happens.
# repquota /home
repquota: Mountpoint (or device) /home not found or has no quota enabled.
repquota: Not all specified mountpoints are using quota.
With 'findmnt' added, the right thing happens.
# repquota `findmnt -vno source /home`
*** Report for user quotas on device /dev/mapper/hosting
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 1180328 0 0 40 0 0
mysql -- 29932 0 0 98 0 0
,,,
And I think it would be a good idea if there was a Virtualmin configuration option to override the path used for editing quotas. Virtualmin can already override the commands used for quotas, but you can't affect the arguments passed to these commands. I guess one way would be to make a wrapper for all the quota commands, but that is a clumsy way to fix this bug.
Submitted by JamieCameron on Mon, 09/22/2014 - 17:39 Comment #3
Actually, there is a setting for this already - the only catch is that it is invisible and may be over-ridden if you click "Re-check Configuration". You can edit
/etc/webmin/virtual-server/config
and add the following :home_quotas=/homereal
mail_quotas=/homereal
Let me know if that works for you - if so, I will add a way to make it more easily configurable.
@aaronroydhouse Did it work for you?
Submitted by rikus on Mon, 11/27/2017 - 13:19 Comment #5
I'm just having the same issue as OP and Jamie's fix seems to work very well, only problem is running "Re-check Configuration", that formats those values as Jamie wrote.
Is there some easy fix we can apply to stop formatting these values?