Documentation

This is the documentation for Mailbox Storage Inspector 1.0.0 on Plesk. It covers installation, what the numbers mean, how resets work, and what to check when a scan does not behave.


What it measures

A mailbox on disk is not one number. The extension reports three that regularly disagree, and the disagreement is usually the answer to the ticket.

FigureSourceWhat it tells you
Folder message bytesOne find pass over cur/ and new/, excluding Dovecot indexesThe real size of the mail itself
maildirsizeDovecot’s quota accounting fileWhat the mail server believes the mailbox uses
On-disk totalAll file bytes under the Maildir, indexes and cache includedWhat the filesystem believes the mailbox uses

Folder sizes are measured by summing regular message files in cur/ and new/, excluding dovecot* index files. A single find pass also produces the total file bytes and the tmp/ bytes, so du is never run. The rules were validated against a live Plesk server: 757.8 MB measured against 757.8 MB maildirsize.

Install and upgrade

Upload the ZIP under Extensions › My Extensions › Upload Extension, or install from the command line:

plesk bin extension --install mailbox-storage-inspector-1.0.0.zip

Upgrading is the same operation with a newer ZIP. If meta.xml changes — vendor URLs, version strings — re-register the extension so Plesk picks it up:

plesk bin extension --register mailbox-storage-inspector

To remove it, uninstalling also deletes the runtime data directory under var/modules/mailbox-storage-inspector/:

plesk bin extension --uninstall mailbox-storage-inspector

The extension appears in two places: under Extensions, and on a domain’s Mail tab, where the button opens that domain’s mailbox list directly.

Your first scan

The landing page lists domains with their mailbox counts, searchable and paginated fifty at a time. Choosing a domain lists its mailboxes with the same controls. Pick a mailbox and press Scan.

The scan runs as a Plesk long task rather than inside the page request. A progress banner appears and the page refreshes every five seconds until the task finishes. Progress is deliberately coarse: the privileged helper does the heavy work in a single call, so the panel can only report that it is running, not how far along it is.

When it completes, the folder table appears. Nothing about the mailbox has been modified at this point.

Reading the results

Folders are listed largest first, each with its message count, message bytes and share of the mailbox. Above the table are the mailbox totals and the comparison figures described earlier.

Warnings appear when the numbers disagree in a way worth acting on:

  • Stale quota accounting — maildirsize does not match the measured total. This is the usual cause of a mailbox reporting as full when it is not.
  • Duplicate INBOX.* folders — a folder and its counterpart both exist, so messages may be split across two paths. The warning names both and says whether they are empty.
  • Oversized tmp/ — interrupted deliveries leaving partial files behind.
  • File count mismatch — a folder holds more files than Dovecot accounts for, often after a restore or a partial migration.

A mailbox that has never been scanned shows not scanned yet. That is not an error; scanning is on demand, not a background crawl of the server.

Freshness and caching

Scan results are cached as one JSON file per mailbox under var/modules/mailbox-storage-inspector/scans/. A result is considered stale after fifteen minutes.

  • A stale result is still shown, clearly labelled with its age and a warning.
  • Mailboxes of 5 GB or smaller refresh automatically in the background when a stale result is opened, at most once every five minutes.
  • Larger mailboxes wait for the Rescan button, because a full pass costs real I/O and should be deliberate.
  • Deleting a cache file is harmless. The mailbox simply shows not scanned yet until the next scan.

Resetting maildirsize

Resetting is the only action that writes anything, and it exists because quota accounting drifts. The sequence is:

  • A backup of the existing maildirsize is written first.
  • The file is removed and doveadm quota recalc rebuilds it.
  • If that fails, plesk repair mail runs as a fallback.
  • Plesk’s usage figures are refreshed, if that option is selected.
  • The reset is written to Plesk’s Action Log as Mailbox usage reset, including the mailbox and the before and after totals.

Reset is POST-only, protected by a one-time token, and requires typing the mailbox address to confirm. It refuses to start while a scan of the same mailbox is running, so a reset cannot race a scan. It never deletes mail and never touches cur/, new/, tmp/ or index files.

CSV export

The folder table exports as CSV for attaching to a support ticket: folder, messages, bytes, human-readable size, share of mailbox, and totals. The file is written with a UTF-8 BOM so spreadsheet applications detect the encoding, and cells beginning with =, +, - or @ are escaped to prevent formula injection. A Copy CSV button puts the same content on the clipboard.

Retention

A retention job runs at most once per day, triggered from the landing page or by a scan:

DataKept for
Scan cache files90 days
Reset backups30 days, capped at 20 per mailbox
Audit entries12 months
Reset tokens and interrupted scan temp files1 hour

Plesk’s own Action Log retention is controlled by Plesk, not by this extension.

Permissions and the privileged helper

The panel runs extension PHP as psaadm, which cannot read Dovecot’s auth socket or /var/qmail/mailnames. Scans and resets therefore go through helpers in sbin/, installed under /usr/local/psa/admin/sbin/modules/mailbox-storage-inspector/ and executed as root through pm_ApiCli::callSbin(). The helpers print JSON; the controller only parses it.

Data files are created with restrictive permissions: 0600 for files and 0700 for directories. The helper validates the mailbox path before touching anything.

Troubleshooting

The scan never finishes

Plesk long tasks can be left behind by a panel restart. Check the task list in Plesk, and look for temporary files older than an hour under the module’s data directory; the retention job clears them on its next run.

Every mailbox says not scanned yet

Expected on a fresh install. The extension does not crawl the server in the background. Scan a mailbox once and its result is cached for fifteen minutes.

Permission denied from a helper

The helpers must be installed under sbin/ and executable by root. Re-register the extension after upgrading, and confirm the files exist under /usr/local/psa/admin/sbin/modules/mailbox-storage-inspector/.

The result is fifteen minutes old

That is the freshness window. Press Rescan, or wait: mailboxes under 5 GB refresh themselves in the background at most once every five minutes.

Reset is greyed out

Either a scan of the same mailbox is running, or the mailbox was not scanned in this session. Scans and resets share a lock on purpose.


Still stuck?

Send the mailbox domain, the Plesk version and the CSV export to support. The CSV usually answers the question on its own.

Scroll to Top