Astral 360 Astral Toolbox

Mail Disk Space

Per-account mailbox usage tracking with per-package quotas, per-account overrides and automatic over-quota reports.

Version 2.1.3 · Store extension, free · requires PHP 7.4+ and Astral Toolbox with the shared style and the task scheduler Track email storage usage per cPanel account, with per-user quota overrides and automatic over-quota reports.

Mail Disk Space measures each account's mail folder (du on <home>/mail), compares it with the quota of its package (in GB) times an optional per-account multiplier, and reports the accounts above quota + buffer: on screen, and by notification (after each scheduled scan, or on demand).

It can also show an "Email disk usage" line on each account's cPanel page, through a module copied into cPanel.

Three tabs: Scan, Overrides, Configuration.


Scan tab

Mail Disk Space — Scan

  • Recalculate all: measures every checked account again. The scan runs on the server by itself: a progress bar counts the accounts, and you can leave the page; the table is updated when it ends. Only one scan runs at a time: the button waits while one runs, scheduled or not.
  • Send over-quota report: sends the report of the last scan now, through the plugin's notifications. It measures nothing. If no account is over quota, nothing is sent and the page says so.
  • Last scan: the age of the last full scan, green when fresh, amber when older than 3 days or never run. Recalc of one account does not change it.
  • Filter: filters the table by user, domain or package as you type.

The table

One row per checked account: an account whose package has no quota (Configuration tab) is not measured and not listed; a line under the table counts them. Columns, sortable (default: usage, fullest first):

Column Meaning
Account The cPanel user, its main domain under it.
Package Its WHM package.
Usage A gauge (green below 80 %, amber from 80 %, red from 100 %), used / allowed in GB, the %, and ×1.5 when the account has a multiplier. A dash when it was not measured.
Recalc Measures this account again.

Rows over quota are highlighted. A badge explains a row without a figure; point at it to read why:

  • Not measured: the mail folder could not be measured (its home could not be found, its mail folder leads to a folder the account does not own, or its size could not be read). Its cPanel page keeps the last figure for up to 7 days.
  • No mail folder: the account has none; 0 is its true figure.

Overrides tab

Mail Disk Space — Overrides

An override gives one account a multiplier of its package's quota: from 1 (the package's quota) to 100, decimals accepted (1.5 = one and a half times the package's quota, 2 = double). It is set on the accounts of the last scan.

  • Over quota: the accounts over their quota in the last scan, fullest first. Click one (or its ×N button) to fill in the form with the whole multiplier its current usage needs; type a decimal one yourself if you prefer.
  • The form: an account (the list suggests the checked accounts) and a multiplier, then Add. Setting 1 is the same as removing the override.
  • Overrides: every override set, with the account's package and usage. Change a multiplier in its field: it is saved when you leave the field or press Enter. × removes it: the account goes back to its package's quota.

Saving measures nothing: the quota is computed again from the last figure, so the lists follow at once, and so does the figure on the account's cPanel page. While a full scan runs, the override is saved all the same and that scan's results carry it.


Configuration tab

Mail Disk Space — Configuration

One form, one Save at the bottom (it says how many changes are not saved yet).

Package quotas

Every package of the server, in one list sorted by name and split into two columns: the packages of WHM → Packages, plus the package of each scanned account WHM no longer lists. Nothing has to be typed. A badge counts the packages checked (3 of 5 packages checked).

  • A quota is a whole number of GB, from 0 to 100 000.
  • Empty or 0: not checked. The accounts of that package are neither measured nor listed on the Scan tab.
  • A package's new quota counts from the next scan.

Shipped quotas: Eco: 1, Essentiel: 1, Plus: 5, Pro: 15, Elite: 15, Dev: 30; any other package starts unchecked.

Settings

Setting Default Notes
Quota buffer 1 GB Added on top of an account's quota before it counts as over quota (from 0 to 10 000 GB, to one decimal place). Restore puts the default back.
Scheduled scan On (after the install), Monday and Thursday at 21:00 A switch, the days, the time (server time); Restore puts the default days and time back. Measures every checked account, then sends the over-quota report when one is over, through the plugin's notifications (Options → Settings → Email & notifications). Run by the plugin's task scheduler: its runs are in /var/log/toolbox-scheduler.log, and the line under the setting shows the last one.
Usage in cPanel On (after the install) Shows "Email disk usage" on each account's cPanel page, from the usage file the scan leaves in the account (~/.cpanel/mailsizeinfo). The module is /var/cpanel/perl/Cpanel/ResourceUsage/Custom/emaildiskusage.pm.

If the setting says the task scheduler is not installed, update Astral Toolbox (Options → Version): the scan does not start without it.

The figure in cPanel

The Email disk usage line on an account's cPanel page shows the figure of the last scan. A figure more than 7 days old is no longer shown: the line disappears for that account, because the number can no longer be trusted.

It disappears when no scan has reached the account for 7 days:

  • The scheduled scan is off and nobody pressed Recalculate all in that time.
  • The extension is disabled, or its licence has ended: nothing scans any more.
  • The scan can no longer measure that account or write its figure. Point at the Not measured badge on the Scan tab to read why.

Any scan brings it back, for 7 more days: Recalculate all on the Scan tab, Recalc on the account's row, or the next run of the scheduled scan. If the extension is off, turn it back on first in Options → Extensions.

One case stays open. The 7-day limit is part of the cPanel module, and the module arrives with an update of the extension. A server whose licence had already ended cannot get that update: it keeps its older module, which goes on showing the last figure, however old. Remove in Options → Extensions takes the module away, and the figure with it. A valid licence lets the update through again.


The over-quota report

Sent through the plugin's notifications (subject [<hostname>] Astral Toolbox - Mail disk usage over quota) when at least one account is above allowed + buffer, in the admin's language:

  • HTML email: a context table (server, count, time of the last full scan), then one row per account (Mailbox, Domain, Used, Quota, %), the largest overage first, with a red badge from 150 %.
  • Plain-text twin: one User : <user> (<domain>) is over quota X / Y Gb line per account (what SMS and Slack channels receive).

Install, update and removal

  • Install turns the scheduled scan on and installs the cPanel module.
  • Update from 2.0.x: the scan keeps its on/off state and takes the default days (Monday and Thursday at 21:00) until you change them; the plans keep their quotas, and -1 reads as 0 (not checked). A multiplier under 1 (2.0.x allowed 0 to stop checking an account) is removed: that account goes back to its package's quota, and the install lists it. The files of the home tile are removed.
  • Update from 1.x keeps your choice: if the 1.x cron file (/etc/cron.d/toolbox-mail-scan) was there, the scheduled scan is on and that file is removed; if not, the scheduled scan stays off. A newer cPanel module replaces the old one.
  • Remove (Options → Extensions) takes away the cPanel module, the usage file left in each account, the 1.x cron file and log if any, and erases the settings, the multipliers and the cached results. While a scan runs, Remove waits: press it again once the scan ends.

Data & file map

Path Purpose
extensions/mail-disk-space/config/settings.default.json Shipped defaults (package quotas, buffer, scheduled scan off until the install turns it on, its days and time)
extensions/mail-disk-space/config/settings.user.json Your settings (kept by updates)
extensions/mail-disk-space/var/scan-cache.json Results of the last scan (root only)
extensions/mail-disk-space/var/overrides.json Per-account multipliers (only values above 1)
extensions/mail-disk-space/var/scan-progress.json Progress of the last full scan, for the Scan tab
extensions/mail-disk-space/var/mail-scan.lock One scan at a time
<account's home folder>/.cpanel/mailsizeinfo Two lines (bytes used, bytes allowed) read by the cPanel module, written with the account's own rights (the home folder can be on /home2, /home3…)
/var/log/toolbox-scheduler.log Each run of the scheduled scan (the plugin's task scheduler)