Email Backup

Stalwart Backup and Restore from a database dump to one account

Leena Taylor Paul By Updated November 15, 2026 10 min read

Quick Answer

A Stalwart backup and restore plan must capture the data store and the blob store from the same moment, because they point at each other. Back up the data store first and the blob store second. Keep the daily blob cleanup out of the gap. Copying the files of a running data store is not a valid backup, so use a native database tool, a snapshot or the offline export.

Name where each of your two stores is copied today.

If you need a Stalwart backup and restore plan, start with Stalwart's own backup and restore page. It says state lives in two places: the data store keeps accounts, metadata and configuration while the blob store keeps message bodies and attachments. Both must come from the same moment. Copying the files of a running data store is not a valid backup.

Below you will find five ways to protect a Stalwart server and the steps to bring back a single account. If you know which loss worries you most, you can choose the matching way before anything breaks.

Start from the loss you fear
  • If your whole server could fail, you need both stores and your configuration files saved together.
  • If one user could lose a mailbox, keep a Vandelay archive for that account.
  • If your users must read mail after Stalwart is gone, keep mail as PST, EML or MBOX files built from a data copy.

Which Parts of Stalwart Does a Backup Have to Capture?

On 15 November 2026 I read Stalwart's backup and restore page and its Vandelay backup page. The first page sorts every part of your server into one of two groups: back it up or leave it out. When you read it, notice that config.json and the environment need a copy of their own.

PartIn the backup?Why
Data store Yes Accounts, metadata, mailboxes, calendars, contacts, configuration objects, TLS certificates, DKIM keys and the outbound queue
Blob store Yes Message bodies and attachments. With the Default blob store they sit inside the data store
config.json and environment Yes, separately Stalwart says to back them up with the system configuration. Include the STALWART variables or your environment file
Search index No Rebuild it with a reindexAccounts task after a restore
In-memory store and cache swap files No Rate limits and greylisting data are short-lived and the cache is rebuilt

The page adds one warning that you may miss. The deleted-item archive of the Enterprise edition is not a backup, because it lives on the same stores and is lost with them.

Who Needs a Stalwart Backup and Restore Plan?

Which of these matches your server?
  • A single-node admin on RocksDB Your server keeps everything in one directory and no one has tested a copy of it.
  • An admin on PostgreSQL or MySQL Your database already has dumps while your message bodies sit somewhere else.
  • An admin with a locked-out user Your user cannot find a mailbox from last week and asks for a restore.
  • An owner retiring Stalwart Your users still need to read their mail after the server is shut down.

Stalwart Backup and Restore: Which of Five Methods Do You Need?

Each method answers a different question, so compare what you must prepare and where it stops.

MethodRequirementLimit
Native database tool pg_dump, mysqldump, fdbbackup or sqlite3 on a running server Covers the data store only. The blob store needs its own copy straight after
Directory snapshot LVM, ZFS, btrfs or a cloud volume snapshot of the whole RocksDB directory with its WAL files A file-by-file copy of a running directory is inconsistent. Stalwart offers no online RocksDB backup
Offline export The stalwart binary with --export on a stopped server Leaves out the search index and config.json. The dump contains passwords and keys
Vandelay archive One SQLite archive for each account and the vandelay command Account data only. No settings, quotas, aliases, credentials or access rights
File copy for Windows A RocksDB or SQLite data copy sitting on a Windows PC plus software that opens it Gives you files that need no Stalwart. Cannot restore into a server. Trial mode is capped at 25 messages per folder

Stalwart's documents describe the first four and Univik's product page describes the fifth. If your server uses RocksDB, the snapshot method is usually the first to consider, because Stalwart offers no online RocksDB backup. A server backup revives Stalwart itself. Mail files serve a person who only owns Outlook or Thunderbird.

A Stalwart backup is finished when a restore works on a second machine. Restore both stores there and open one mailbox before you trust the copy.

Nick Rogers, Founder of Univik
Nick Rogers
Founder, Univik
Making Windows software since 2013

In What Order Do You Take a Stalwart Blob Store Backup?

Stalwart saves message bodies to the blob store before the data store points at them. Deleting a message removes only that pointer. A daily cleanup then removes bodies that nothing points at. The cleanup time comes from the blobCleanupSchedule setting, 04:00 by default with no grace period. These five steps follow that order.

  1. Find your data store type. Check whether your server uses RocksDB, SQLite, PostgreSQL, MySQL, MariaDB or FoundationDB. Each type has its own native backup tool, so the next step depends on this answer.
  2. Back up the data store first. For PostgreSQL use pg_dump or a base backup with WAL archiving. For MySQL and MariaDB use mysqldump --single-transaction. For FoundationDB use fdbbackup. For SQLite enter sqlite3 <database> ".backup <file>" or stop the server and copy the files.
  3. Back up the blob store straight after. Copy or snapshot the blob directory. For S3 or Azure, turn on bucket versioning with a lifecycle rule that expires old versions. If you reverse the order, restored messages can point to bodies that your blob copy does not have. Stalwart says those cannot be repaired.
  4. Keep the cleanup out of the gap. Schedule your backup outside the blobCleanupSchedule time or change that setting. A versioned bucket or the Default blob store avoids this rule, because old versions stay or bodies share the data store.
  5. Save the configuration and move the copies. Back up config.json and your STALWART environment variables with the system configuration. Keep every backup in a different failure domain from the server.

With RocksDB and the Default blob store, one snapshot of the directory captures everything. Without snapshot support, stop the server, copy the directory and start it again.

How Does the Stalwart Offline Export and Import Work?

The binary can export the data store and the blob bodies to dump files and import them into an empty store. Stop your server first, because a running SQL export is not point-in-time and a second process cannot open your running RocksDB directory.

Enter stalwart --config /etc/stalwart/config.json --export /var/backups/stalwart/2026-10-15 to export. Enter the same command with --import to bring a dump back.

1. Export every data family

Do this: Stalwart says to leave EXPORT_TYPES unset for a backup, because every data family is then exported. The blob family matters most. Without it, the restored data store has no links to message bodies and the next cleanup removes them.

2. Protect the dump

Do this: The dump contains passwords, keys, DKIM private keys and certificates. It leaves out the search index and config.json, so back those up separately.

3. Reindex after an import

Do this: After you import a dump, start a StoreMaintenance task of type reindexAccounts. After you restore a directory copy, start the server and check search.

Do not use the built-in export on a running database as your backup. Stalwart says it is not a consistent snapshot. In a cluster, one backup covers all nodes, because they share the data store and blob store.

Stalwart Backup and Restore Steps for One Account

A Vandelay archive is a self-contained SQLite file for one account. It can hold mailboxes, messages, identities, Sieve scripts, address books, calendars and files. Bodies and files are saved once by content hash, so duplicated attachments use less space. Read Stalwart's Vandelay backup page for the importers that match your server.

  1. Set the password safely. Set VANDELAY_PASSWORD in your environment, so the password stays out of the process list and your scheduler logs.
  2. Create the archive. Enter vandelay import jmap --url https://mail.example.com --auth-basic user@example.com --account-name user@example.com /backups/alice.sqlite. If you repeat the same import, it reads only what changed and removes items that were deleted on the source.
  3. Restore from the archive. Enter vandelay export --url https://mail.example.org --auth-basic user@example.com --account-name user@example.com /backups/alice.sqlite. The export creates only what the target is missing, so it works on an account that still has some data. If it is interrupted, enter the same command again.

The option --prune also deletes folders, calendars, address books, contacts, events, Sieve scripts and files on the target that the archive does not describe. It never deletes messages. Quotas, aliases, credentials, access rights and server settings are not in an archive, so set them again after a restore.

If you refresh one archive in place, you keep a single current copy and use the least space. If you keep dated copies of the archive, you keep a history at the cost of more storage.

Only a restore proves a backup. Stalwart suggests a test on a separate host: restore both stores, start the server with your config.json adjusted to them, sign in, open a mailbox with attachments and search after a reindex.

Add Mail Files That Open Without Stalwart

Your server backups bring mail back only into another Stalwart. For mail that people can read with no server at all, Univik Stalwart Mail Recovery opens your RocksDB or SQLite data copy on a Windows PC and saves every account you mark as PST, EML or MBOX files. No Stalwart process starts. PostgreSQL, MySQL, MariaDB and FoundationDB are outside what Univik claims.

You choose accounts and one format and every account goes to the folder you name.
  1. Copy the data folder. Stop Stalwart or work from a snapshot. Then move the complete data folder with its message data to your Windows PC, because a partial copy can leave accounts without bodies.
  2. Open the copy. Start the software and browse to your folder. Every account in it appears in a list.
  3. Choose accounts and a format. Mark the accounts you need and choose a format (PST, EML or MBOX). Then name where the files go. A folder choice or a date filter makes your output smaller.
  4. Start the save. Begin with your output folder set. If the save stops, select Resume and read the log for finished accounts.
  5. Open one file. Load a PST in Outlook or double-click an EML file and compare its folders with the account list.

Limitations: trial mode saves 25 messages per folder. Univik saves mail files only. It cannot upload to a server, restore into Stalwart or save server settings.

Windows 11 or 10 plus .NET Framework 4.8 must be on your PC. I did not time a big Stalwart copy, so check a few accounts in the trial before you plan many. My guide to export Stalwart to PST covers the Outlook side.

Keep Stalwart mail as files that open on Windows

Windows reads your copied Stalwart data and saves each account in a format that opens without any Stalwart release.

Download Free Trial Select a Licence - From $999

Save a single account in trial mode and check its folder tree against your account list.

What If Your Stalwart Restore Does Not Work?

1. Messages point to missing bodies

Do this: This happens when your blob store was copied before your data store or when the cleanup fired between the two copies. Stalwart says such messages cannot be repaired, so repeat both backups in the right order.

2. Search finds nothing

Do this: The search index is not part of any backup. Start a reindexAccounts task and give it time before you search again.

3. A restored account is missing settings

Do this: A Vandelay archive contains account data only. Set quotas, aliases, credentials and access rights again.

If your data store will not open, Univik's Stalwart mail recovery page covers damaged copies.

Which Stalwart Pages Support the Steps Above?

My sources are Stalwart's backup and restore page and its Vandelay backup page, both read on 15 November 2026. If those pages leave something out, this guide leaves it out too. The backup page never says which Stalwart versions accept a dump from another version, so ask Stalwart before you restore across versions.

Univik's backup page supplies the product details. Stalwart's pages change with each release, so check every command against your own version.

Key Takeaways
  • A Stalwart backup needs the data store and the blob store from the same moment, in that order.
  • Copying the files of a running data store is not a valid backup.
  • The offline export needs a stopped server and leaves out the search index and config.json.
  • A Vandelay archive restores one account but not its quotas, aliases or settings.
  • Only a test restore on a second host proves that your backup works.

FAQ: Stalwart Backup and Restore

How does a Stalwart backup and restore work?

Back up the data store with its native tool and the blob store straight after it. Keep config.json and your environment separately. To restore, put both stores back, start the server and reindex if your search index was not restored.

Is copying the Stalwart data directory a valid backup?

Not on a running server. Stalwart says copying the files of a running data store is not a valid backup. Use a snapshot of the whole directory with its WAL files or stop the server first.

Which comes first in a Stalwart blob store backup?

The data store comes first and the blob store second. The reverse order can leave restored messages pointing to bodies that your blob copy does not have. Those cannot be repaired.

Does the Stalwart offline export include the search index?

No. It leaves out the search index and config.json with the environment. It includes passwords, keys, DKIM private keys and certificates, so protect the dump.

How do I back up one Stalwart account?

Create a Vandelay archive with the importer that matches your server. The archive is one SQLite file for the account. Repeat the same import to refresh it and use vandelay export to restore.

Does a Vandelay archive include quotas and aliases?

No. Access rights, quotas, aliases, credentials and server settings are not in an archive.

Can I open Stalwart mail without a server?

Yes. Univik Stalwart Mail Recovery opens your RocksDB or SQLite data copy on Windows and saves the accounts you mark as PST, EML or MBOX files. It cannot restore them into Stalwart.

Can I try the Windows copy before buying?

Yes. The trial output is limited to 25 messages for each folder, so one saved account is enough to check the result.

Leena Taylor Paul

I took each Stalwart command here from vendor pages read on November 15, 2026. Univik facts come from its backup page.

More Guides for Stalwart Mail

Choose the guide that matches the next step for your Stalwart data.

Stalwart guides 3