GoAdmio

quota

Turn disk quotas on or off for the server, and apply each hosting account's disk-space and inode limits to its system user

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

GoAdmio hosting accounts have a disk-space limit and an inode (file count) limit. /go/quota makes the operating system enforce those limits, so an account that reaches its limit gets "Disk quota exceeded" errors instead of using more space.

/go/quota is a one-command setup and sync tool. It:

It can also turn quotas off with off.


Quick start

# Enable quotas and apply every account's limits
/go/quota on

# Disable quotas
/go/quota off

# Re-apply limits when quotas are already enabled
/go/quota

Syntax

/go/quota [on|off]
Form Behavior
/go/quota on Prepares the filesystem, turns quotas on, and applies all account limits.
/go/quota off Turns quotas off and records that in the database. Nothing else is changed.
/go/quota Prepares the filesystem again, then, only if quotas are already recorded as enabled, re-applies all account limits. It does not turn quotas on.

Any other argument is ignored, and the command behaves as if you passed none.

The command needs root. When it is run as another user, it re-runs itself with sudo. Use the full path /go/quota, because the system also has its own quota program.


Options

There are no --option flags. The only arguments are:

Argument Required Default Notes
on No — Enables quotas. Reports failure if the filesystem can't support them yet.
off No — Disables quotas. Must be the first argument.

Where the limits come from

Limits are read from each account in GoAdmio's Site table. They are set when the account is created (see create) or edited later.

Account setting Applied as Notes
Disk space (stored in bytes) Hard block limit, in KB The soft limit is set to 0, so there is no grace period.
Inode Hard inode limit The soft limit is set to 0.

A value of 0 means unlimited for that setting.


Output

Outcome What you get
Quotas enabled Quota is successfully enabled.
Quotas disabled Quota is successfully disabled.
Enabling failed Failed to enable quotas. followed by the commands to run in Rescue Mode.
Limits applied One line per account that has a limit, for example [3/12] example.com Disk Space 5120000 KB.

Notes on the output:


Examples

# Enable quotas
/go/quota on
# After changing an account's disk limit, re-apply limits
/go/quota
# Check that quotas are working
repquota -a
quota -uvs example.com
# Turn quotas off
/go/quota off

If quotas can't be enabled, the command prints these steps. Run them from Rescue Mode, with the device name it shows for /:

tune2fs -O quota /dev/<device>
reboot

Troubleshooting

Symptom Likely cause Fix
Failed to enable quotas. The filesystem doesn't have the quota feature enabled yet. Run the tune2fs and reboot steps the command prints, from Rescue Mode, then run /go/quota on again.
The failure message names the wrong device The hint always uses the device that holds /, even when /home is a separate partition. Run tune2fs -O quota on the device that actually holds /home (check with df /home).
An account's limit isn't enforced Both its disk space and inode are 0, so it is skipped. Set a limit on the account, then run /go/quota.
An account was changed to unlimited but is still limited Accounts with limits of 0 are skipped, so the old kernel limit stays. Remove it manually with setquota -u <username> 0 0 0 0 <mount point>.
Limits are not applied after /go/quota Quotas aren't recorded as enabled in the database. Run /go/quota on.
Nothing changes on an XFS server The script adds the mount options for XFS, but then uses quotacheck and quotaon, which are ext4 tools. XFS quotas are normally managed with xfs_quota and need the mount option applied at mount time. Use ext4, or set up XFS quotas manually.
The server stops booting after a change A bad /etc/fstab entry. Restore the backup from Rescue Mode: cp /etc/fstab.bak /etc/fstab.
The inode count shown for an account looks wrong The count is read from the last line of quota -uvs, which can shift when the device name is long or the account is in a grace period. Check with repquota -a.
The quota state in GoAdmio doesn't match reality A failed run or a manual change. Run /go/quota off, then /go/quota on.

Details

What happens on each run

flowchart TD
    A["quota [on|off]"] --> B["Re-run as root if needed, log the call"]
    B --> C{"Argument is off?"}
    C -- "Yes" --> D["quotaoff, Quota=0 in database, exit 1"]
    C -- "No" --> E["Back up /etc/fstab once"]
    E --> F["Add usrquota,grpquota to /home or / in fstab"]
    F --> G["Remount, then quotacheck"]
    G --> H{"Argument is on?"}
    H -- "No" --> L
    H -- "Yes" --> I{"quotaon succeeds?"}
    I -- "No" --> J["Quota=0, print Rescue Mode steps, exit 1"]
    I -- "Yes" --> K["Quota=1 in database"]
    K --> L{"Quota=1 in database?"}
    L -- "Yes" --> M["setquota for each account, store inodes used"]
    L -- "No" --> N["Reset InodeUsed to 0 for all accounts"]

Changes to /etc/fstab

Step Behavior
Backup /etc/fstab is copied to /etc/fstab.bak only if that file doesn't exist yet. Later runs don't update it.
/home on its own partition In an active line that mounts /home as ext4 or xfs, the first defaults becomes defaults,usrquota,grpquota.
No /home entry The same change is made to the active ext4 line for /.
Already enabled If usrquota appears anywhere in /etc/fstab, nothing is changed.
Other options A line that doesn't contain defaults is not changed.

After a change, systemctl daemon-reload runs. The quota mount point is /home when it is in /etc/fstab, otherwise /.

Preparing the filesystem

Every run, including one with no argument, remounts the mount point with mount -o remount and runs quotacheck twice. The first run (-cugm -f -F vfsv1) creates or rebuilds the quota files in the vfsv1 format, and the second one (-avugm) checks all quota-enabled filesystems. This can take a while on a large disk.

Success and failure of on

quotaon -avug is treated as failed when its output is empty, or contains resource busy, switch, or deprecated. These usually mean the filesystem uses the old quota format and needs the tune2fs -O quota feature enabled. On failure the database is set to quotas off. The /etc/fstab changes are not undone.

Applying limits

For each folder in /home that contains a www folder, the command reads the account's username, disk space, and inode limit from the Site table. If either limit is above 0, it runs:

setquota -u <username> 0 <disk limit in KB> 0 <inode limit> <mount point>

It then reads the account's used inodes with quota -uvs <username> and saves them in the InodeUsed column.

When quotas are off, InodeUsed is set to 0 for every account.

Turning quotas off

off runs quotaoff -avug and sets the quota state to off. It leaves the /etc/fstab options, the quota files, the limits already set on each user, and the InodeUsed values in place. Quotas can be switched back on later with /go/quota on.


See also

Command Description
fixquota Recalculate every account's disk and bandwidth usage, block FTP uploads over the disk quota, and suspend expired accounts
create Create a GoAdmio account from the command line
clean Delete old backups, trash, session files, and expired mail to free up disk space
speed Check hard disk type, speed, and health
fix Reset ownership and permissions for one account or all accounts
backup Back up one or all GoAdmio accounts