problem converting mailbox to maildir with doveadm
Hello. I have an email server for testing purposes, using postfix 3.5.17 and dovecot 2.3.13.
Initially, I configured postfix to use mailboxes, but now I've changed it to maildir.
Emails arrive fine, and dovecot manages them well by pop3 or imap. No problems there.
But I still have a lot of emails in different mailboxes which I'd like to convert to maildir.
I found mb2md, which seems to do a pretty good job. Once the mailbox is converted, dovecot manages the emails without a problem.
But I also wanted to learn how to use doveadm to convert mailboxes to maildir format.
I read all the documentation I could find and tried to learn how this command works. I tried different combinations, but couldn't convert mailboxes to maildir. I always get error messages. I've been unable to understand why.
I tried to sync, backup, and import, to no avail. I also tried dsync, which seems to have a different syntax, with the same result.
Sorry for bothering you, but if you could explain to me how this command works, I'd be very grateful.
Example: I have a user, let's say joe, who has a mailbox in /var/mail/joe and I'd like to transfer those emails to /home/joe/Maildir
How do I use doveadm in this situation?
Best regards
Kenneth
#copy mailbox, using new mail_location setting doveadm backup -u "${USER}" maildir:/home/${USERNAME}/Maildir/ doveadm sync -u "${USER}" maildir:/home/${USERNAME}/Maildir/
#Update user to use maildir instead of old method, update sql? .... mail_location=maildir:/home/${USERNAME}/Maildir/
doveadm auth cache flush doveadm proxy kick "${USER}"
#copy any late additions to mailbox, using old mail_location setting doveadm sync -u "${USER}" mbox:/var/mail/${USERNAME}
#remove old format mailbox rm /var/mail/${USERNAME}
I do this one user at a time, then when done adjust my config file,
and remove the mail_location setting from sql, though my script has a
few other fixups and error checking
Quoting Kenneth Irving <ken@fq.edu.uy>:
Hello. I have an email server for testing purposes, using postfix
3.5.17 and dovecot 2.3.13.Initially, I configured postfix to use mailboxes, but now I've
changed it to maildir.Emails arrive fine, and dovecot manages them well by pop3 or imap.
No problems there.But I still have a lot of emails in different mailboxes which I'd
like to convert to maildir.I found mb2md, which seems to do a pretty good job. Once the mailbox
is converted, dovecot manages the emails without a problem.But I also wanted to learn how to use doveadm to convert mailboxes
to maildir format.I read all the documentation I could find and tried to learn how
this command works. I tried different combinations, but couldn't
convert mailboxes to maildir. I always get error messages. I've been
unable to understand why.I tried to sync, backup, and import, to no avail. I also tried
dsync, which seems to have a different syntax, with the same result.Sorry for bothering you, but if you could explain to me how this
command works, I'd be very grateful.Example: I have a user, let's say joe, who has a mailbox in
/var/mail/joe and I'd like to transfer those emails to
/home/joe/MaildirHow do I use doveadm in this situation?
Best regards
Kenneth
Patrick: thanks a lot!
So it's not enough to do a 'backup', it's also necessary to 'sync' the mailboxes, but using the old mail_location, that is
mail_location = mbox:~/mail:INBOX=/var/mail/%u
Otherwise the command doesn't find the mailbox. It said source and destination were the same! That was one of many errors I was getting.
I had tried using '-o mail_location=/var/mail/' but also got errors and wasn't able to transfer the emails. I finally restored mail_location to it's former value, restarted dovecot, and it worked!
I wasn't aware that I had first to backup and then sync to transfer all emails.
Thanks again! Best regards
Kenneth
On Sun, 5 Feb 2023, Patrick Domack wrote:
#copy mailbox, using new mail_location setting doveadm backup -u "${USER}" maildir:/home/${USERNAME}/Maildir/ doveadm sync -u "${USER}" maildir:/home/${USERNAME}/Maildir/
#Update user to use maildir instead of old method, update sql? .... mail_location=maildir:/home/${USERNAME}/Maildir/
doveadm auth cache flush doveadm proxy kick "${USER}"
#copy any late additions to mailbox, using old mail_location setting doveadm sync -u "${USER}" mbox:/var/mail/${USERNAME}
#remove old format mailbox rm /var/mail/${USERNAME}
I do this one user at a time, then when done adjust my config file, and remove the mail_location setting from sql, though my script has a few other fixups and error checking
Quoting Kenneth Irving <ken@fq.edu.uy>:
Hello. I have an email server for testing purposes, using postfix 3.5.17 and dovecot 2.3.13.
Initially, I configured postfix to use mailboxes, but now I've changed it to maildir.
Emails arrive fine, and dovecot manages them well by pop3 or imap. No problems there.
But I still have a lot of emails in different mailboxes which I'd like to convert to maildir.
I found mb2md, which seems to do a pretty good job. Once the mailbox is converted, dovecot manages the emails without a problem.
But I also wanted to learn how to use doveadm to convert mailboxes to maildir format.
I read all the documentation I could find and tried to learn how this command works. I tried different combinations, but couldn't convert mailboxes to maildir. I always get error messages. I've been unable to understand why.
I tried to sync, backup, and import, to no avail. I also tried dsync, which seems to have a different syntax, with the same result.
Sorry for bothering you, but if you could explain to me how this command works, I'd be very grateful.
Example: I have a user, let's say joe, who has a mailbox in /var/mail/joe and I'd like to transfer those emails to /home/joe/Maildir
How do I use doveadm in this situation?
Best regards
Kenneth
Please also see https://doc.dovecot.org/admin_manual/migrating_mailboxes/ if you already haven't.
Aki
On 05/02/2023 22:16 EET Kenneth Irving <ken@fq.edu.uy> wrote:
Patrick: thanks a lot!
So it's not enough to do a 'backup', it's also necessary to 'sync' the mailboxes, but using the old mail_location, that is
mail_location = mbox:~/mail:INBOX=/var/mail/%u
Otherwise the command doesn't find the mailbox. It said source and destination were the same! That was one of many errors I was getting.
I had tried using '-o mail_location=/var/mail/' but also got errors and wasn't able to transfer the emails. I finally restored mail_location to it's former value, restarted dovecot, and it worked!
I wasn't aware that I had first to backup and then sync to transfer all emails.
Thanks again! Best regards
Kenneth
On Sun, 5 Feb 2023, Patrick Domack wrote:
#copy mailbox, using new mail_location setting doveadm backup -u "${USER}" maildir:/home/${USERNAME}/Maildir/ doveadm sync -u "${USER}" maildir:/home/${USERNAME}/Maildir/
#Update user to use maildir instead of old method, update sql? .... mail_location=maildir:/home/${USERNAME}/Maildir/
doveadm auth cache flush doveadm proxy kick "${USER}"
#copy any late additions to mailbox, using old mail_location setting doveadm sync -u "${USER}" mbox:/var/mail/${USERNAME}
#remove old format mailbox rm /var/mail/${USERNAME}
I do this one user at a time, then when done adjust my config file, and remove the mail_location setting from sql, though my script has a few other fixups and error checking
Quoting Kenneth Irving <ken@fq.edu.uy>:
Hello. I have an email server for testing purposes, using postfix 3.5.17 and dovecot 2.3.13.
Initially, I configured postfix to use mailboxes, but now I've changed it to maildir.
Emails arrive fine, and dovecot manages them well by pop3 or imap. No problems there.
But I still have a lot of emails in different mailboxes which I'd like to convert to maildir.
I found mb2md, which seems to do a pretty good job. Once the mailbox is converted, dovecot manages the emails without a problem.
But I also wanted to learn how to use doveadm to convert mailboxes to maildir format.
I read all the documentation I could find and tried to learn how this command works. I tried different combinations, but couldn't convert mailboxes to maildir. I always get error messages. I've been unable to understand why.
I tried to sync, backup, and import, to no avail. I also tried dsync, which seems to have a different syntax, with the same result.
Sorry for bothering you, but if you could explain to me how this command works, I'd be very grateful.
Example: I have a user, let's say joe, who has a mailbox in /var/mail/joe and I'd like to transfer those emails to /home/joe/Maildir
How do I use doveadm in this situation?
Best regards
Kenneth
The sync is optional, but if you have dovecot/postfix alive and
active, it could receive new emails while the backup was running, so a
sync would be needed to update the changes since backup was run.
This is why I do it twice, once after backup, to catch any during the
*longer* backup run, and once after I move the user to the new
mailbox, so it catches anything adding between that last sync and the
move actually happening.
In my actual script, I'll backup 1000 users, then sync and move them
one at a time, then do a follow up sync for all the users, then delete
the old mailstore.
Then I will repeat for the next group of 1000 users
Quoting Kenneth Irving <ken@fq.edu.uy>:
Patrick: thanks a lot!
So it's not enough to do a 'backup', it's also necessary to 'sync'
the mailboxes, but using the old mail_location, that ismail_location = mbox:~/mail:INBOX=/var/mail/%u
Otherwise the command doesn't find the mailbox. It said source and
destination were the same! That was one of many errors I was getting.I had tried using '-o mail_location=/var/mail/' but also got errors
and wasn't able to transfer the emails. I finally restored
mail_location to it's former value, restarted dovecot, and it worked!I wasn't aware that I had first to backup and then sync to transfer
all emails.Thanks again! Best regards
Kenneth
On Sun, 5 Feb 2023, Patrick Domack wrote:
#copy mailbox, using new mail_location setting doveadm backup -u "${USER}" maildir:/home/${USERNAME}/Maildir/ doveadm sync -u "${USER}" maildir:/home/${USERNAME}/Maildir/
#Update user to use maildir instead of old method, update sql? .... mail_location=maildir:/home/${USERNAME}/Maildir/
doveadm auth cache flush doveadm proxy kick "${USER}"
#copy any late additions to mailbox, using old mail_location setting doveadm sync -u "${USER}" mbox:/var/mail/${USERNAME}
#remove old format mailbox rm /var/mail/${USERNAME}
I do this one user at a time, then when done adjust my config file,
and remove the mail_location setting from sql, though my script has
a few other fixups and error checkingQuoting Kenneth Irving <ken@fq.edu.uy>:
Hello. I have an email server for testing purposes, using postfix
3.5.17 and dovecot 2.3.13.Initially, I configured postfix to use mailboxes, but now I've
changed it to maildir.Emails arrive fine, and dovecot manages them well by pop3 or imap.
No problems there.But I still have a lot of emails in different mailboxes which I'd
like to convert to maildir.I found mb2md, which seems to do a pretty good job. Once the
mailbox is converted, dovecot manages the emails without a problem.But I also wanted to learn how to use doveadm to convert mailboxes
to maildir format.I read all the documentation I could find and tried to learn how
this command works. I tried different combinations, but couldn't
convert mailboxes to maildir. I always get error messages. I've
been unable to understand why.I tried to sync, backup, and import, to no avail. I also tried
dsync, which seems to have a different syntax, with the same result.Sorry for bothering you, but if you could explain to me how this
command works, I'd be very grateful.Example: I have a user, let's say joe, who has a mailbox in
/var/mail/joe and I'd like to transfer those emails to
/home/joe/MaildirHow do I use doveadm in this situation?
Best regards
Kenneth
participants (3)
-
Aki Tuomi
-
Kenneth Irving
-
Patrick Domack