dsync and namespaces

Charlie Hothersall-Thomas
Tue, 22 Dec 2015 10:28:23 -0000

`doveconf -n' output:

> # 2.2.10: /etc/dovecot/dovecot.conf
> # OS: Linux 3.10.0-229.20.1.el7.x86_64 x86_64 CentOS Linux release 7.2.1511
(Core)
> listen = *
> mail_location = maildir:~/Maildir/
> namespace {
>   inbox = yes
>   location >   prefix >   separator = /
>   type = private
> }
> namespace {
>   location = maildir:/srv/mail/
>   prefix = Public/
>   separator = /
>   subscriptions = no
>   type = public
> }
> passdb {
>   driver = pam
> }
> ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
> ssl_key = </etc/pki/dovecot/private/dovecot.pem
> userdb {
>   driver = passwd
> }

I have some public mailboxes in /srv/mail -- Public/Alpha and
Public/Mike -- using configuration taken more or less verbatim from
http://wiki2.dovecot.org/SharedMailboxes/Public. These are stored in
Maildir format; here's a sample of how things look on disk at the
moment:

> /srv/mail/
> ??? .Alpha
> ??? ??? cur
> ??? ??? ??? 1450775948.M24820P23708.cht,S=8186,W=8360:2,S
> ??? ??? dovecot.index.cache
> ??? ??? dovecot.index.log
> ??? ??? dovecot-uidlist
> ??? ??? maildirfolder
> ??? ??? new
> ??? ??? tmp
> ??? cur
> ??? dovecot.index.log
> ??? dovecot-uidlist
> ??? dovecot-uidvalidity
> ??? dovecot-uidvalidity.5679158d
> ??? maildirfolder
> ??? .Mike
> ??? ??? cur
> ??? ??? ??? 1450775948.M202327P23708.cht,S=8405,W=8576:2,S
> ??? ??? ??? 1450775948.M257575P23708.cht,S=5590,W=5732:2,S
> ??? ??? dovecot.index.cache
> ??? ??? dovecot.index.log
> ??? ??? dovecot-uidlist
> ??? ??? maildirfolder
> ??? ??? new
> ??? ??? tmp
> ??? new
> ??? tmp

I'm trying to convert these public mailboxes from Maildir to mdbox
format. My end goal is a directory structure like the following. I
obtained this example by emptying /srv/mail, changing `location
maildir:/srv/mail/' to use mdbox, and then delivering some messages into
Public/Alpha and Public/Mike:

> /srv/mail/
> ??? dovecot-uidvalidity
> ??? dovecot-uidvalidity.567915fa
> ??? mailboxes
> ??? ??? Alpha
> ??? ??? ??? dbox-Mails
> ??? ???     ??? dovecot.index.cache
> ??? ???     ??? dovecot.index.log
> ??? ??? dbox-Mails
> ??? ??? ??? dovecot.index.log
> ??? ??? Mike
> ???     ??? dbox-Mails
> ???         ??? dovecot.index.cache
> ???         ??? dovecot.index.log
> ??? storage
>     ??? dovecot.map.index.log
>     ??? m.1

I know that dsync can be used to convert between mailbox formats, but is
this possible in conjunction with namespaces? I can convert one of my
mailboxes to an arbitrary mdbox location on disk using...

> dsync -o mail_location=mdbox:/tmp/dbox/ mirror maildir:/srv/mail/.Mike/

... although this puts the messages inside an INBOX mailbox:

> /tmp/dbox/
> ??? mailboxes
> ??? ??? INBOX
> ???     ??? dbox-Mails
> ???         ??? dovecot.index.cache
> ???         ??? dovecot.index.log
> ??? storage
>     ??? dovecot.map.index.log
>     ??? m.1

I could run this once per public mailbox, writing each to a different
mdbox location, but am unaware of a method to merge them such that they
would work with my Public/ namespace.

Is it possible to use dsync to convert my public Maildir mailboxes to
mdbox, resulting in my desired directory structure above? I think I want
to be able to tell dsync the location as a mailbox name, rather than a
disk location, although this doesn't appear to be possible.

If not, is there another solution? My best idea at the moment is to make
the configuration change and then re-deliver all messages by mailbox
name.

Thanks in advance, and happy holidays,

--
Charlie Hothersall-Thomas | w:   https://charlie.ht
                          | e:   me at charlie.ht
                          | pgp: 4096R/C3676E3E