User Quotas
Our control panel restricts disk usage by resource (e.g. a user login or database).
Databases
For databases, we simply use du to check database usage via a cron job
and, if a database has gone over, we disable each database user with write
access to that database.
Users
For email and web site disk usage, we use the ext4 quota sytem to set a quota and depend on it to inform users when they have gone over.
Enabling quotas
quotas are enabled automatically by the sower --live generate:fstab command
when operating on a weborigin or mailstore server.
This script takes the following steps:
- Ensures that the line for the partition in
/etc/fstabsets the mount options to:defaults,usrjquota=aquota.user,jqfmt=vfsv1,nosuid,nodev - Ensures
quotapackage is installed - Turns on the ext4 internal quota system with:
tune2fs -O quota /path/to/device - Mounts the partition
- This step is now deprecated and is no longer run: If the
aquota.userfile is absent, runsquotacheck -cum /path(we don’t need an aquota.user file any more because the tune2fs command records that information within the filesystem metadata). - Runs
quotaon --user -p /pathand if it is successful, runsquotaon /path(if not successful, it means it’s already on)
Keeping it all in sync
A cron job runs on every server with quota
(/usr/local/share/red/node/sbin/update-disk-usage) that checks disk usage and
copies it back to the contorl panel.