Dovecot dsync and ISPConfig

Discussion in 'General' started by pyte, Nov 2, 2022.

  1. pyte

    pyte Well-Known Member HowtoForge Supporter

    Hi!
    In my new setup there are 2 mailservers mail01 and mail02. The mail02 is just a mirror of mail01 and mails get synced via dovecots dsync feature. This is all setup and works just fine.

    At this point i need to migrate ~700GB of maildata from an old system to the new setup. As the old system runs dovecot and is capable of dsync i will use it. However i have some concern regarding the vmail home path. Let's assume the path on the old system is /home/vmail/domain.tld/username/. When i now use doveadm backup to one way sync all maildata, is there anything that might not work?

    Has anyone here experience with dovadm sync/backup form one system to a ISPConfig Setup?
     
  2. recin

    recin Active Member

    If you have mail passwords you can transfer mails with imapsync
     
  3. pyte

    pyte Well-Known Member HowtoForge Supporter

    What should be the benefit of using this, instead of dovecots built in features for the job?
     
  4. recin

    recin Active Member

    I don't know because i never used doveadm backup sorry,
     
  5. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Have you look into ISPConfig ISPcopy and migration tool?
     
  6. pyte

    pyte Well-Known Member HowtoForge Supporter

    I use the migration tool to migrate my old ISPConfig Web/DB Servers into my new setup. However the mailsystem is not an ISPConfig setup, it is an very large but old "self made" construct that is built upon postfix/dovecot/rspamd. This is not a single server either and is integrated into an very old infrastructur.
    In the last month i've done quiet some work of writing migration scripts to move all the data via ISPConfigs SOAP API, and it works. I can move all customer data from the old databases to ISPConfig. I can move all mail related data, like accounts, alias, forwards, whitelist and blacklist rules. I can move all DNS related data. What's missing is to migrate the vmail data to the new setup, dovecots dsync capabilities seem to be the right tool, i just don't have any experience with it besides mirroring it with a secound mailserver. So migrating over that amount of data from and old system to ISPConfig is new to me, and hoped anyone might have some experience with it to give some recommendations.
     
  7. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    if everything in the vmail folder is in the same format that ispconfig uses, you can just rsync the whole lot in one go.
     
    ahrasis and pyte like this.
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    I would recommend using rsync as well if the old system uses Maildir format. The ISPConfig Migration Tool moves all data with rsync too, no matter if the source is ISPConfig, Plesk, Cpanel or Confixx. And in case your old system still uses mbox format, then there is a script provided by dovecot to convert mbox to maildir. Another benefit of using rsync is that you can resync the data incrementally.
     
    ahrasis and pyte like this.
  9. pyte

    pyte Well-Known Member HowtoForge Supporter

    Sounds like a pretty good idea. Going to test this tomorrow and report back.
     
    ahrasis likes this.
  10. pyte

    pyte Well-Known Member HowtoForge Supporter

    Tested it with:
    Code:
    rsync -av --rsync-path="sudo rsync" /home/vmail/domain.tld/user1/ [email protected]:/var/vmail/domain.tl/user1/Maildir/
    After the data was copied, i've added the mail account to thunderbird with the new server as IMAP Server and everything works just as expected.

    Does anyone know how to use rsync with wildcards? As you see in the example above my source and target paths are not the same, so i need something like this:
    Code:
    rsync ... /home/vmail/$DOMAIN/$USER [email protected]:/var/vmail/$DOMAIN/$USER/Maildir
    Can i achieve this with a onliner or should i write a simple shellscript?
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    I would use a shell script for that.
     
    ahrasis and pyte like this.
  12. pyte

    pyte Well-Known Member HowtoForge Supporter

    If someone might find this usefull, this is what i came up with:
    Code:
    mailboxes=`find /home/vmail -maxdepth 2 -mindepth 2 -type d -printf '%h/%f\n' | sed -e 's/\/home\/vmail\//g/'`
    
    for mbox in $mailboxes
    do
        echo "rsync -av --rsync-path="sudo rsync" /home/vmail/${mbox} [email protected]:/var/vmail/${mbox}/Maildir"
    
    done
    
    Note that for now it only echos the rsync command for testing purposes. I don't know if it is the best idea to run rsync for each folder one after another but this should work for now.
     
    Planea, ahrasis and till like this.

Share This Page