0.15.5 -> 0.16.3 - Account disk usage displayed incorrectly

Issue Description

After a successful upgrade from 0.15.5 to 0.16.3, when I go to Accounts → and scroll down to Details, Disk Usage displays wrong information.
Immediately after the migration it displayed 0 bytes, while all emails for that account were migrated and their actual disk usage is around 14 GB.
Also, just for test, I sent an email to that account from Proton, and the disk usage afterwards became few kilobytes.
Now it is even negative -40144 B.

For the upgrade from 0.15.5 to 0.16.3, I’ve been following these steps:

Expected Behavior

The disk usage per account should reflect the usage of all emails, from before the upgrade to 0.16 and after.

Actual Behavior

Seems the the disk usage reflects only the emails received after the upgrade to 0.16.
Though, there was a time when the usage was also negative.

Relevant Log Output

I don’t see any logs related to the disk usage.

Stalwart Version

v0.16.x

Installation Method

Built from source

Database Backend

PostgreSQL

Blob Storage

PostgreSQL

Search Engine

PostgreSQL

Directory Backend

Internal

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

This is a known post-migration step that was missed. From the v0.16 upgrade guide (UPGRADING/v0_16.md):

Disk quotas were reset to zero during the wipe and need to be rebuilt from the actual mailbox contents.

The fix is straightforward:

  1. Log in to the admin WebUI.
  2. Navigate to the Tasks section.
  3. Trigger the “Recalculate disk quotas” task.

This spawns one subtask per user account. Each subtask scans that user’s actual mailbox storage and updates the usage counter. On a large deployment (e.g. 14 GB of mail) it may take a while — progress is visible in the Tasks panel. Once it completes, the displayed disk usage should be accurate.

The negative value you’re seeing is a side-effect of incremental writes (new mail arriving) being applied on top of a zero baseline before recalculation has run — that’s expected to resolve once the recalculation task finishes.

For reference, this step is described in the v0.16 upgrade guide under “Post-migration tasks → Recalculate disk quotas”.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong. If you found it useful, mention @helpbot in any reply to ask follow-up questions and the bot will respond again.

Indeed, the issue was resolved by creating a task to recalculate the storage.

This is how to do it for a single tenant deployment:

Management → Tasks → Scheduled → Create task

Task type: Perform account maintenance operations
Account: <SELECT_A_SPECIFIC_ACCOUNT>
Maintenance Type: Recalculate storage quota usage for the account

A separate task needs to be created for each account.

When we set “Task type” to “Perform tenant maintenance operations”, we must select a tenant.
In single tenant deployment, we can’t select a tenant.

Great news that it’s resolved! Thank you for posting the exact steps for a single-tenant deployment — that’s a helpful clarification that the per-account maintenance task is the right path when there’s no tenant to select. This will be useful for others hitting the same issue after a migration.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong. If you found it useful, mention @helpbot in any reply to ask follow-up questions and the bot will respond again.