mdbox to Maildir conversion

Freddy

Verified User
Joined
Apr 14, 2016
Messages
72
I have a backup from a domain that comes from another DirectAdmin server. The backup restores fine but there the mail accounts do not show their e-mails. The accounts do show that diskspace is being used. When I check the files that are being stored in the mail location for a specific user I can see two folders. One named "Maildir" and one named "mdbox". All mails seem to be stored in mdbox. I googled and found that there are two types of mailbox storage and it seems I restored a backup from a server that used "the other type". My server uses Maildir format but when restoring the backup with mdbox it doesn't convert automatically to Maildir.

How do I restore the mail for this domain?
 

Freddy

Verified User
Joined
Apr 14, 2016
Messages
72
I found this site suggesting that I use dsync to convert the mail storage. Tried it but got an error.

Bash:
[root@myServer ~]# dsync -u myuser@mydomain.nl mirror mbox:~/mail:INBOX=/home/mydomain/imap/mydomain.nl/myuser/mdbox
Error: Couldn't load plugin /usr/lib/dovecot/doveadm/lib10_doveadm_sieve_plugin.so: Module is for different ABI version 2.3.ABIv11(2.3.11.3) (we have 2.3.ABIv14(2.3.14))
dsync(myuser@mydomain.nl): Error: Mail locations must use the same virtual mailbox hierarchy separator (specify separator for the default namespace)
 

Freddy

Verified User
Joined
Apr 14, 2016
Messages
72
The error with the plugin is solved by building pigeonhole. But the error for the seperator stays the same.

Any help would be greatly appreciated.
 

Freddy

Verified User
Joined
Apr 14, 2016
Messages
72
Found a solution. For anyone reading this and having the same problem, here are the commands I used.

Bash:
# Change the owner of the files in mdbox so doveadm has access.
chown -R mail /home/myDomain/imap/myDomain.nl/myUser/mdbox
# Convert mdbox to Maildir. Do this in a temporary folder and not straight into the existing Maildir of the user because this will result in a permission error.
doveadm -o first_valid_uid=1 -o namespace=inbox -o namespace/inbox/inbox=yes -o namespace/inbox/separator=. -o mail_location=mdbox:/home/myDomain/imap/myDomain.nl/myUser/mdbox backup -u mail maildir:/home/myDomain/imap/myDomain.nl/myUser/Maildir_test
# Not copy the converted Maildir into the existing Maildir of the user.
cp -rf /home/myDomain/imap/myDomain.nl/myUser/Maildir_test/. /home/myDomain/imap/myDomain.nl/myUser/Maildir
# Change the owner of the files in Maildir so the user has access.
chown -R myDomain:mail /home/myDomain/imap/myDomain.nl/myUser/Maildir
 
Top