| 1 |
.. cyrusman:: reconstruct(8) |
| 2 |
|
| 3 |
.. author: Nic Bernstein (Onlight) |
| 4 |
|
| 5 |
.. _imap-reference-manpages-systemcommands-reconstruct: |
| 6 |
|
| 7 |
=============== |
| 8 |
**reconstruct** |
| 9 |
=============== |
| 10 |
|
| 11 |
Reconstruct mailboxes |
| 12 |
|
| 13 |
Synopsis |
| 14 |
======== |
| 15 |
|
| 16 |
.. parsed-literal:: |
| 17 |
|
| 18 |
**reconstruct** [ **-C** *config-file* ] [ **-p** *partition* ] [ **-x** ] [ **-r** ] |
| 19 |
[ **-f** ] [ **-U** ] [ **-s** ] [ **-q** ] [ **-G** ] [ **-R** ] [ **-o** ] |
| 20 |
[ **-O** ] [ **-M** ] *mailbox*... |
| 21 |
|
| 22 |
**reconstruct** [ **-C** *config-file* ] [ **-p** *partition* ] [ **-x** ] [ **-r** ] |
| 23 |
[ **-f** ] [ **-U** ] [ **-s** ] [ **-q** ] [ **-G** ] [ **-R** ] [ **-o** ] |
| 24 |
[ **-O** ] [ **-M** ] **-u** *user*... |
| 25 |
|
| 26 |
**reconstruct** [ **-C** *config-file* ] [ **-p** *partition* ] [ **-r** ] |
| 27 |
[ **-q** ] **-V** *version* *mailbox*... |
| 28 |
|
| 29 |
**reconstruct** [ **-C** *config-file* ] [ **-p** *partition* ] [ **-r** ] |
| 30 |
[ **-q** ] **-V** *version* **-u** *user*... |
| 31 |
|
| 32 |
**reconstruct** [ **-C** *config-file* ] **-P** *cyrus-header-paths*... |
| 33 |
|
| 34 |
Description |
| 35 |
=========== |
| 36 |
|
| 37 |
**reconstruct** rebuilds one or more IMAP mailboxes. It can be |
| 38 |
used to recover from almost any sort of data corruption. |
| 39 |
|
| 40 |
If **reconstruct** can find existing header and index files, it |
| 41 |
attempts to preserve any data in them that is not derivable from the |
| 42 |
message files themselves. The state **reconstruct** attempts to |
| 43 |
preserve includes the flag names, flag state, and internaldate. |
| 44 |
|
| 45 |
**reconstruct** derives all other information from the message files. |
| 46 |
|
| 47 |
**reconstruct** |default-conf-text| Any mailbox directory underneath |
| 48 |
the path specified in the ``partition-news`` configuration option is |
| 49 |
assumed to be in news format. |
| 50 |
|
| 51 |
**reconstruct** does not adjust the quota usage recorded in any quota |
| 52 |
root files. After running **reconstruct**, it is advisable to run |
| 53 |
:manpage:`quota(8)` with the **-f** switch in order to fix the quota |
| 54 |
root files. |
| 55 |
|
| 56 |
When upgrading versions of Cyrus software, it may be necessary to run |
| 57 |
**reconstruct** with the **-V** option, to rebuild indexes to a |
| 58 |
given version (or *max* for the most recent). Note that the **-V** |
| 59 |
option cannot be combined with most other reconstruct options. If |
| 60 |
a mailbox needs reconstructing you should do that first, and then |
| 61 |
upgrade it with **-V** once it's good. |
| 62 |
|
| 63 |
Options |
| 64 |
======= |
| 65 |
|
| 66 |
.. program:: reconstruct |
| 67 |
|
| 68 |
.. option:: -C config-file |
| 69 |
|
| 70 |
|cli-dash-c-text| |
| 71 |
|
| 72 |
.. option:: -p partition, --partition=partition |
| 73 |
|
| 74 |
Search for the listed (non-existant) mailboxes on the indicated |
| 75 |
*partition*. Create the mailboxes in the database in addition to |
| 76 |
reconstructing them. (not compatible with the use of wildcards) |
| 77 |
|
| 78 |
.. option:: -x, --ignore-disk-metadata |
| 79 |
|
| 80 |
When processing a mailbox which is not in the mailbox list (e.g. |
| 81 |
via the **-p** or **-f** options), do not import the metadata from |
| 82 |
the mailbox, instead create it anew (this specifically affects at |
| 83 |
least the mailbox's seen state unique identifier, user flags, and |
| 84 |
ACL). |
| 85 |
|
| 86 |
.. option:: -r, --recursive |
| 87 |
|
| 88 |
Recursively reconstruct all sub-mailboxes of the mailboxes or |
| 89 |
mailbox prefixes given as arguments. |
| 90 |
|
| 91 |
.. option:: -f, --scan-filesystem |
| 92 |
|
| 93 |
Examine the filesystem underneath mailbox, adding all directories |
| 94 |
with a ``cyrus.header`` found there as new mailboxes. Useful for |
| 95 |
restoring mailboxes from backups. |
| 96 |
|
| 97 |
.. option:: -s, --no-stat |
| 98 |
|
| 99 |
Don't stat underlying files. This makes reconstruct run faster, at |
| 100 |
the expense of not noticing some issues (like zero byte files or |
| 101 |
size mismatches). "**reconstruct -s**" should be quite fast. |
| 102 |
|
| 103 |
.. option:: -q, --quiet |
| 104 |
|
| 105 |
Emit less verbose information to syslog. |
| 106 |
|
| 107 |
.. option:: -n, --dry-run |
| 108 |
|
| 109 |
Don't make any changes. Problems are reported, but not fixed. |
| 110 |
|
| 111 |
.. option:: -G, --force-reparse |
| 112 |
|
| 113 |
Force re-parsing of the underlying message (checks GUID |
| 114 |
correctness). Reconstruct with -G should fix all possible |
| 115 |
individual message issues, including corrupted data files. |
| 116 |
|
| 117 |
.. option:: -I, --update-uniqueids |
| 118 |
|
| 119 |
If two mailboxes exist with the same UNIQUEID and reconstruct visits |
| 120 |
both of them, -I will cause the second mailbox to have a new UNIQUEID |
| 121 |
created for it. If you don't specify -I, you will just get a syslog |
| 122 |
entry telling you of the clash. |
| 123 |
|
| 124 |
.. option:: -R, --guid-mismatch-keep |
| 125 |
|
| 126 |
Perform a UID upgrade operation on GUID mismatch files. Use this |
| 127 |
option if you think your index is corrupted rather than your |
| 128 |
message files, or if all backup attempts have failed and you're |
| 129 |
happy to be served the missing files. |
| 130 |
|
| 131 |
.. option:: -U, --guid-mismatch-discard |
| 132 |
|
| 133 |
Use this option if you have corrupt message files in your spool and |
| 134 |
have been unable to restore them from backup. This will make the |
| 135 |
mailbox IOERROR free and fix replication. |
| 136 |
|
| 137 |
WARNING: |
| 138 |
this deletes corrupt message files for ever - so make sure you've |
| 139 |
exhausted other options first! |
| 140 |
|
| 141 |
.. option:: -o, --ignore-odd-files |
| 142 |
|
| 143 |
Ignore odd files in your mailbox disk directories, instead of |
| 144 |
complaining about them. Probably useful if you are using some |
| 145 |
tool which adds additional tracking files. |
| 146 |
|
| 147 |
.. option:: -O, --delete-odd-files |
| 148 |
|
| 149 |
Delete odd files. This is the opposite of **-o**. |
| 150 |
|
| 151 |
.. option:: -M, --prefer-mboxlist |
| 152 |
|
| 153 |
Prefer mailboxes.db over cyrus.header - will rewrite ACL or |
| 154 |
uniqueid from the mailboxes.db into the header file rather than the |
| 155 |
other way around. |v3-new-feature| |
| 156 |
|
| 157 |
.. option:: -V version, --set-version=version |
| 158 |
|
| 159 |
Change the ``cyrus.index`` minor version to a specific *version*. |
| 160 |
This can be useful for upgrades or downgrades. Use a magical |
| 161 |
version of *max* to upgrade to the latest available database format |
| 162 |
version. |
| 163 |
|
| 164 |
.. option:: -u, --userids |
| 165 |
|
| 166 |
Instead of mailbox prefixes, give userids on the command line |
| 167 |
|
| 168 |
.. option:: -P, --header-paths |
| 169 |
|
| 170 |
Instead of mailbox prefixes, give paths to cyrus.header files on |
| 171 |
the command line. The paths can be mailbox directories, or |
| 172 |
explicit cyrus.header filenames. |
| 173 |
This will ONLY create/repair mailboxes.db records using data in |
| 174 |
cyrus.header and cyrus.index. |
| 175 |
|
| 176 |
Examples |
| 177 |
======== |
| 178 |
|
| 179 |
.. parsed-literal:: |
| 180 |
|
| 181 |
**reconstruct -r -f** *tech.support* |
| 182 |
|
| 183 |
.. |
| 184 |
|
| 185 |
Recursively reconstruct all mailboxes within the *tech.support* |
| 186 |
hierarchy, restoring any directories containing ``cyrus.header`` |
| 187 |
files. |
| 188 |
|
| 189 |
.. only:: html |
| 190 |
|
| 191 |
:: |
| 192 |
|
| 193 |
tech.support uid 9634 rediscovered - appending |
| 194 |
tech.support uid 9635 rediscovered - appending |
| 195 |
tech.support uid 9642 rediscovered - appending |
| 196 |
tech.support |
| 197 |
tech.support.Archive |
| 198 |
tech.support.Spam |
| 199 |
|
| 200 |
|
| 201 |
.. parsed-literal:: |
| 202 |
|
| 203 |
**reconstruct -r -f** *tech.support.Archive.2%* |
| 204 |
.. |
| 205 |
|
| 206 |
Recursively reconstruct all mailboxes within the |
| 207 |
*tech.support.Archive* hierarchy with names beginning with '2', |
| 208 |
restoring any directories containing ``cyrus.header`` |
| 209 |
files. |
| 210 |
|
| 211 |
.. only:: html |
| 212 |
|
| 213 |
:: |
| 214 |
|
| 215 |
tech.support.Archive.2001 |
| 216 |
tech.support.Archive.2002 |
| 217 |
tech.support.Archive.2003 |
| 218 |
tech.support.Archive.2004 |
| 219 |
tech.support.Archive.2005 |
| 220 |
tech.support.Archive.2006 |
| 221 |
tech.support.Archive.2007 |
| 222 |
tech.support.Archive.2008 |
| 223 |
tech.support.Archive.2009 |
| 224 |
tech.support.Archive.2010 |
| 225 |
tech.support.Archive.2011 |
| 226 |
tech.support.Archive.2012 |
| 227 |
tech.support.Archive.2013 |
| 228 |
|
| 229 |
.. parsed-literal:: |
| 230 |
|
| 231 |
**reconstruct -r -f -u** *jsmith* |
| 232 |
|
| 233 |
.. |
| 234 |
|
| 235 |
Recursively reconstruct all mailboxes belonging to *jsmith*, |
| 236 |
restoring any directories containing ``cyrus.header`` files. |
| 237 |
|
| 238 |
.. only:: html |
| 239 |
|
| 240 |
:: |
| 241 |
|
| 242 |
user.jsmith |
| 243 |
user.jsmith.Archive |
| 244 |
user.jsmith.Drafts |
| 245 |
user.jsmith.Lists |
| 246 |
user.jsmith.Outbox |
| 247 |
user.jsmith.Sent |
| 248 |
user.jsmith.Spam |
| 249 |
user.jsmith.Trash |
| 250 |
|
| 251 |
History |
| 252 |
======= |
| 253 |
|
| 254 |
The options **-k** (keep flags) and **-g** (clear GUID) have been |
| 255 |
deprecated in Cyrus version 2.4. |
| 256 |
|
| 257 |
The **-u** and **-V** options were added in Cyrus version 2.5. |
| 258 |
|
| 259 |
The **-M** option was added in Cyrus version 3.0. |
| 260 |
|
| 261 |
Files |
| 262 |
===== |
| 263 |
|
| 264 |
/etc/imapd.conf |
| 265 |
|
| 266 |
See Also |
| 267 |
======== |
| 268 |
|
| 269 |
:cyrusman:`imapd.conf(5)` |