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