[Dovecot] Best way to change index location on mdbox
Hi,
right now my index directory is part of the users home directory: mail_home = /var/mail/%d/%n mail_location = mdbox:~/mdbox
I want the indexes to be stored in a different location: mail_home = /var/mail/%d/%n mail_location = mdbox:~/mdbox:INDEX=/var/indexes/%d/%n
If I just switch this setting and reload the configuration, no e-mails are shown to the user.
After restoring the whole maildir I deleted all dovecot.index.*-files from that user and starting dovecot with the new index directory setting, I got the following error after connecting. I expected the index files to be regenerated but I got an error:
May 18 23:11:12 imap(test@example.com): Panic: file mail-storage.c: line 787 (mailbox_check_mismatching_separators): assertion fail ed: (strncmp(vname, ns->prefix, ns->prefix_len-1) == 0) May 18 23:11:12 imap(test@example.com): Error: Raw backtrace: /usr/local/lib/dovecot/libdovecot.so.0(+0x4475a) [0x7f993f60875a] -> /usr/local/lib/dovecot/libdovecot.so.0(+0x447a6) [0x7f993f6087a6] -> /usr/local/lib/dovecot/libdovecot.so.0(i_error+0) [0x7f993f5df5bf] -
/usr/local/lib/dovecot/libdovecot-storage.so.0(mailbox_open_stream+0) [0x7f993f8ccca0] -> /usr/local/lib/dovecot/libdovecot-storage.so. 0(mailbox_open+0xf) [0x7f993f8cccbf] -> /usr/local/lib/dovecot/libdovecot-storage.so.0(mdbox_storage_rebuild_in_context+0xb2b) [0x7f993f8 8eeab] -> /usr/local/lib/dovecot/libdovecot-storage.so.0(mdbox_sync_begin+0x7ec) [0x7f993f88ce7c] -> /usr/local/lib/dovecot/libdovecot-st orage.so.0(mdbox_sync+0x46) [0x7f993f88cee6] -> /usr/local/lib/dovecot/libdovecot-storage.so.0(mdbox_storage_sync_init+0x87) [0x7f993f88c fc7] -> /usr/local/lib/dovecot/libdovecot-storage.so.0(mailbox_sync_init+0x31) [0x7f993f8cb851] -> /usr/local/lib/dovecot/libdovecot-stor age.so.0(mailbox_sync+0x27) [0x7f993f8cc387] -> /usr/local/lib/dovecot/libdovecot-storage.so.0(index_storage_get_status+0x28f) [0x7f993f8 ef41f] -> dovecot/imap(imap_status_get+0x7a) [0x41756a] -> dovecot/imap(cmd_status+0x14f) [0x40e85f] -> dovecot/imap(command_exec+0x3d) [ 0x41158d] -> dovecot/imap() [0x41050e] -> dovecot/imap() [0x4105ed] -> dovecot/imap(client_handle_input+0x135) [0x410815] -> dovecot/imap (client_input+0x5f) [0x41113f] -> /usr/local/lib/dovecot/libdovecot.so.0(io_loop_call_io+0x36) [0x7f993f6148f6] -> /usr/local/lib/dovecot /libdovecot.so.0(io_loop_handler_run+0x9f) [0x7f993f61592f] -> /usr/local/lib/dovecot/libdovecot.so.0(io_loop_run+0x28) [0x7f993f614898] -> /usr/local/lib/dovecot/libdovecot.so.0(master_service_run+0x13) [0x7f993f601023] -> dovecot/imap(main+0x2a4) [0x419364] -> /lib/libc.s o.6(__libc_start_main+0xfd) [0x7f993f280c8d] -> dovecot/imap() [0x408e89]
How can I change the index directory without losing mails?
Patrick
On Fri, 2012-05-18 at 23:44 +0200, Patrick Westenberg wrote:
right now my index directory is part of the users home directory: mail_home = /var/mail/%d/%n mail_location = mdbox:~/mdbox
I want the indexes to be stored in a different location: mail_home = /var/mail/%d/%n mail_location = mdbox:~/mdbox:INDEX=/var/indexes/%d/%n
If I just switch this setting and reload the configuration, no e-mails are shown to the user.
You must not lose indexes with mdbox or you'll lose message flags and mails may also end up going to wrong mailboxes.
After restoring the whole maildir I deleted all dovecot.index.*-files from that user and starting dovecot with the new index directory setting, I got the following error after connecting. I expected the index files to be regenerated but I got an error:
May 18 23:11:12 imap(test@example.com): Panic: file mail-storage.c: line 787 (mailbox_check_mismatching_separators): assertion fail ed: (strncmp(vname, ns->prefix, ns->prefix_len-1) == 0)
This is a little bit strange bug that is also happening to another guy. I haven't been able to reproduce it.
How can I change the index directory without losing mails?
The easiest and the most reliable solution would be to just move the index files to their new location while Dovecot is stopped.
Timo Sirainen schrieb:
You must not lose indexes with mdbox or you'll lose message flags and mails may also end up going to wrong mailboxes.
Yes, have been there but this behaviour is confusing me as I find conflicting information in the wiki:
http://wiki2.dovecot.org/IndexFiles "If index files are missing, Dovecot creates them automatically when the mailbox is opened."
http://wiki2.dovecot.org/MailboxFormat/dbox This data cannot be automatically recreated, so it is important that Index files are treated with the same care as message data files.
So why do I lose mails if I delete index file but if e.g. a director connects to a backend with non existing index files yet, they are created.
On Sat, 2012-05-19 at 20:43 +0200, Patrick Westenberg wrote:
Timo Sirainen schrieb:
You must not lose indexes with mdbox or you'll lose message flags and mails may also end up going to wrong mailboxes.
Yes, have been there but this behaviour is confusing me as I find conflicting information in the wiki:
http://wiki2.dovecot.org/IndexFiles "If index files are missing, Dovecot creates them automatically when the mailbox is opened."
This and maybe other parts of documentation was written before dbox format was created. It's true for maildir/mbox, but not for dbox. I updated that page now.
http://wiki2.dovecot.org/MailboxFormat/dbox This data cannot be automatically recreated, so it is important that Index files are treated with the same care as message data files.
So why do I lose mails if I delete index file but if e.g. a director connects to a backend with non existing index files yet, they are created.
Losing mails probably happens only when imap crashes while it's trying to recreate the indexes. Once that bug is fixed it should happen.
But you really don't want any of this with mdbox, not deleting index files or having per-backend index files.
Timo Sirainen schrieb:
But you really don't want any of this with mdbox, not deleting index files or having per-backend index files.
What is the director/backend-stuff useful for if per-backend index files is not recommended? As far as I understood, that's what it's all about.
Patrick
On 20.5.2012, at 1.03, Patrick Westenberg wrote:
Timo Sirainen schrieb:
But you really don't want any of this with mdbox, not deleting index files or having per-backend index files.
What is the director/backend-stuff useful for if per-backend index files is not recommended? As far as I understood, that's what it's all about.
No. Director is simply about making sure that more than one server won't access the same user's mailbox simultaneously. I'm not recommending per-backend index files to any kind of setups. Perhaps the NFS wiki page should be changed also.
Timo Sirainen schrieb:
No. Director is simply about making sure that more than one server won't access the same user's mailbox simultaneously. I'm not recommending per-backend index files to any kind of setups. Perhaps the NFS wiki page should be changed also.
So using a director it should be possible to have my mailstore on a Ext3/4 filesystem? I won't need a cluster filesystem or NFS?
On 20.5.2012, at 1.23, Patrick Westenberg wrote:
Timo Sirainen schrieb:
No. Director is simply about making sure that more than one server won't access the same user's mailbox simultaneously. I'm not recommending per-backend index files to any kind of setups. Perhaps the NFS wiki page should be changed also.
So using a director it should be possible to have my mailstore on a Ext3/4 filesystem? I won't need a cluster filesystem or NFS?
Using a regular proxy with permanent user assignments you can distribute your mailboxes to a bunch of ext3/4 fs servers.
Using a director you get temporary user assignments and you need a clusterfs/NFS.
participants (2)
-
Patrick Westenberg
-
Timo Sirainen