Wrong Quota Calculation when multiple Partitions
short description
Quota is partially wrong calculated. USED Space is OK, SOFT+HARD Limits NOT
In /etc/fstab we added a new Partition "HC_Volume_3460284" (auto-generated by Hetzner > its a new Cloud Hosting Volume)
UUID=10214293-64c7-4d24-b031-c9b5967f6ddb / ext4 discard,errors=remount-ro,usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0 0 1
/dev/disk/by-id/scsi-0HC_Volume_3460284 /mnt/HC_Volume_3460284 ext4 discard,nofail,defaults,usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0 0 0
To get Quota working on the new Volume i added ,usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0
to that new line and did:
quotaoff -avug
mount -o remount /mnt/HC_Volume_3460284
quotacheck -avugm
quotaon -avug
Quotacheck looks good:
quotacheck: Scanning /dev/sda1 [/] done
quotacheck: Checked 298128 directories and 2625766 files
quotacheck: Scanning /dev/sdb [/mnt/HC_Volume_3460284] done
quotacheck: Checked 7299 directories and 43468 files
At this point, ISPConfig show the correct USED values for the 2 Partitions, but the HARD+SOFT Limit values are doubled (and i guess the whole calculation, automatic deactivation, Email notifications...
repquota -au gives:
...
*** Report for user quotas on device /dev/sda1
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
web111 -- 1339748 22528000 22529024 50707 0 0
*** Report for user quotas on device /dev/sdb
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
web111 -- 11050676 22528000 22529024 50763 0 0
used+used=ok, soft+soft not - because the Limit of 22GB would then be 44GB, the same on hard+hard
In /server/lib/classes/cron.d/100-monitor_hd_quota.inc.php the calculation adds wrongly SOFT and HARD together.
$data['user'][$username]['used'] += $s[2];
$data['user'][$username]['soft'] += $s[3];
$data['user'][$username]['hard'] += $s[4];
$data['user'][$username]['files'] += $s[5];
It should be counted only once, because on 2 Partitions SOFT+HARD is doubled, on 3 Partitions tripled and so on.
correct behaviour
SOFT+HARD Limits should be calculated correctly, causing wrong Numbers in Stats and Emails.
environment
Server OS: Ubuntu 16.04 LTS
ISPConfig version: 3.1.15