RECONSTRUCT(8)

πŸ’– RECONSTRUCT(8) πŸ’–

okay bestie, sit down, hydrate, and let me tell you about reconstruct β€” the Cyrus IMAP glow-up tool. this is the manual page for it, and yes we are doing the whole thing, no skips, no shortcuts, because you deserve the full lore. 🫢


✨ NAME ✨

reconstruct β€” Cyrus IMAP documentation

like, literally: reconstruct mailboxes. it rebuilds them. it's the "ctrl+alt+delete but make it healing" of IMAP. πŸ’…


🌸 SYNOPSIS 🌸

so here's how you summon it, in all its forms:

reconstruct [ -C config-file ] [ -p partition ] [ -x ] [ -r ]
    [ -f ] [ -U ] [ -s ] [ -q ] [ -G ] [ -R ] [ -o ]
    [ -O ] [ -M ] mailbox...
reconstruct [ -C config-file ] [ -p partition ] [ -x ] [ -r ]
    [ -f ] [ -U ] [ -s ] [ -q ] [ -G ] [ -R ] [ -o ]
    [ -O ] [ -M ] -u user...
reconstruct [ -C config-file ] [ -p partition ] [ -r ]
    [ -q ] -V version mailbox...
reconstruct [ -C config-file ] [ -p partition ] [ -r ]
    [ -q ] -V version -u user...
reconstruct [ -C config-file ] -P cyrus-header-paths...

periodt. five whole moods of this command. πŸ’«


πŸ¦‹ DESCRIPTION πŸ¦‹

reconstruct rebuilds one or more IMAP mailboxes. it can be used to recover from almost any sort of data corruption β€” yeah, it's giving emergency room but for your mail spool. πŸ₯✨

if reconstruct can find existing header and index files, it attempts to preserve any data in them that is not derivable from the message files themselves. the state reconstruct attempts to preserve includes the flag names, flag state, and internaldate. it's very "i will save what i can, bestie, i promise." 😭

reconstruct derives all other information from the message files.

reconstruct reads its configuration options out of the imapd.conf(5) file unless specified otherwise by -C. Any mailbox directory underneath the path specified in the partition-news configuration option is assumed to be in news format.

⚠️ heads up: reconstruct does not adjust the quota usage recorded in any quota root files. after running reconstruct, it is advisable to run quota(8) with the -f switch in order to fix the quota root files.

when upgrading versions of Cyrus software, it may be necessary to run reconstruct with the -V option, to rebuild indexes to a given version (or max for the most recent). note that the -V option cannot be combined with most other reconstruct options. if a mailbox needs reconstructing you should do that first, and then upgrade it with -V once it's good. do it in the right order, i'm begging. πŸ™


πŸ‘‘ OPTIONS πŸ‘‘

okay this is the main character section, buckle up. every single flag, no crumbs left behind. πŸ’…

  • -C config-file β€” Use the specified configuration file config-file rather than the default imapd.conf(5).
  • -p partition, --partition=partition β€” Search for the listed (non-existant) mailboxes on the indicated partition. Create the mailboxes in the database in addition to reconstructing them. (not compatible with the use of wildcards)
  • -x, --ignore-disk-metadata β€” When processing a mailbox which is not in the mailbox list (e.g. via the -p or -f options), do not import the metadata from the mailbox, instead create it anew (this specifically affects at least the mailbox's seen state unique identifier, user flags, and ACL).
  • -r, --recursive β€” Recursively reconstruct all sub-mailboxes of the mailboxes or mailbox prefixes given as arguments.
  • -f, --scan-filesystem β€” Examine the filesystem underneath mailbox, adding all directories with a cyrus.header found there as new mailboxes. Useful for restoring mailboxes from backups.
  • -s, --no-stat β€” Don't stat underlying files. This makes reconstruct run faster, at the expense of not noticing some issues (like zero byte files or size mismatches). "reconstruct -s" should be quite fast.
  • -q, --quiet β€” Emit less verbose information to syslog.
  • -n, --dry-run β€” Don't make any changes. Problems are reported, but not fixed.
  • -G, --force-reparse β€” Force re-parsing of the underlying message (checks GUID correctness). Reconstruct with -G should fix all possible individual message issues, including corrupted data files.
  • -I, --update-uniqueids β€” If two mailboxes exist with the same UNIQUEID and reconstruct visits both of them, -I will cause the second mailbox to have a new UNIQUEID created for it. If you don't specify -I, you will just get a syslog entry telling you of the clash.
  • -R, --guid-mismatch-keep β€” Perform a UID upgrade operation on GUID mismatch files. Use this option if you think your index is corrupted rather than your message files, or if all backup attempts have failed and you're happy to be served the missing files.
  • -U, --guid-mismatch-discard β€” Use this option if you have corrupt message files in your spool and have been unable to restore them from backup. This will make the mailbox IOERROR free and fix replication.
🚨 WARNING: this deletes corrupt message files for ever β€” so make sure you've exhausted other options first! like, FOREVER ever. no takebacks. 😭
  • -o, --ignore-odd-files β€” Ignore odd files in your mailbox disk directories, instead of complaining about them. Probably useful if you are using some tool which adds additional tracking files.
  • -O, --delete-odd-files β€” Delete odd files. This is the opposite of -o.
  • -M, --prefer-mboxlist β€” Prefer mailboxes.db over cyrus.header β€” will rewrite ACL or uniqueid from the mailboxes.db into the header file rather than the other way around. This feature was introduced in version 3.0.
  • -V version, --set-version=version β€” Change the cyrus.index minor version to a specific version. This can be useful for upgrades or downgrades. Use a magical version of max to upgrade to the latest available database format version.
  • -u, --userids β€” Instead of mailbox prefixes, give userids on the command line.
  • -P, --header-paths β€” Instead of mailbox prefixes, give paths to cyrus.header files on the command line. The paths can be mailbox directories, or explicit cyrus.header filenames. This will ONLY create/repair mailboxes.db records using data in cyrus.header and cyrus.index.

🌈 EXAMPLES 🌈

real scenarios, real vibes, fr fr:

reconstruct -r -f tech.support

Recursively reconstruct all mailboxes within the tech.support hierarchy, restoring any directories containing cyrus.header files.

reconstruct -r -f tech.support.Archive.2%

Recursively reconstruct all mailboxes within the tech.support.Archive hierarchy with names beginning with '2', restoring any directories containing cyrus.header files.

reconstruct -r -f -u jsmith

Recursively reconstruct all mailboxes belonging to jsmith, restoring any directories containing cyrus.header files.

slay. πŸŽ€


πŸ•°οΈ HISTORY πŸ•°οΈ

the lore drop:

  • The options -k (keep flags) and -g (clear GUID) have been deprecated in Cyrus version 2.4. (gone but not forgotten, rip bozos πŸͺ¦)
  • The -u and -V options were added in Cyrus version 2.5.
  • The -M option was added in Cyrus version 3.0.

πŸ“ FILES πŸ“

  • /etc/imapd.conf

πŸ’œ SEE ALSO πŸ’œ


🧚 AUTHOR 🧚

The Cyrus Team, Nic Bernstein (Onlight)


1993–2026, The Cyrus Team


and that's the whole thing, bestie. this page is from Cyrus IMAP 3.12.3, dated Jul 15, 2026 β€” if you ever need to cite it, that's your receipt. go forth and reconstruct responsibly, and remember: back up first, always, no cap. πŸ’–βœ¨πŸ«Ά

πŸ“¦ where this page comes from