Your question
Orphaned blobs in MinIO not cleaned up after account deletion
Version: 0.16.7
Data store: PostgreSQL
Blob store: MinIO
Problem:
I deleted several test accounts and domains months ago (from 0.15.x). About 20GB of data remain in MinIO that appear to be orphaned, which are no longer referenced by any active account. Running the maintenance tasks completes without errors but does not reclaim any space in MinIO.
How can data from these old accounts be pruned from the system? Whatever was going on in 0.15.x never removed the blob data and that has now carried over.
Let me look into how Stalwart handles blob cleanup and maintenance tasks.
The blob store clean-up runs on a separate schedule from general data-store maintenance. The two are independent: running the data-store maintenance task does not purge the blob store.
What controls blob clean-up:
The blobCleanupSchedule field on the DataRetention singleton sets how often the blob store is purged (default: daily at 04:00). The blob store purge is a StoreMaintenance task with maintenanceType: purgeBlob. If that scheduled task has not been running (or was not working in 0.15.x), blobs will accumulate indefinitely.
How to address the backlog:
-
Check that blobCleanupSchedule is set – go to Settings › Storage › Data Retention in the WebUI and confirm the blob clean-up schedule is enabled and not set to null.
-
Trigger a one-off blob purge immediately – you can create a StoreMaintenance task with maintenanceType: purgeBlob on demand via the WebUI (Management › Tasks) or the CLI:
stalwart-cli create task/StoreMaintenance
with the body {"@type": "StoreMaintenance", "maintenanceType": "purgeBlob"}. This will walk the data store’s blob reference table and delete any blobs in MinIO that are no longer referenced by any active account.
-
Verify the blob cleanup schedule going forward – the default is daily at 04:00. You can confirm or change it on the DataRetention object:
{ "blobCleanupSchedule": {"@type": "Daily", "hour": 4, "minute": 0} }
The key thing to understand is that the scheduled maintenance tasks you were running were likely purgeData or purgeAccounts, not purgeBlob. The blob purge is a separate operation that must either run on schedule or be triggered explicitly.
Relevant docs:
This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.
Perhaps those blobs are still being referenced from spam samples. Stalwart deletes blobs from the store only when there are no internal references left.
The accounts and domains are removed. It has been over 3 months since they were removed and the blobs are still around.
How can I troubleshoot this to find out if they are being referenced from somewhere?