Skip to main content

rsync or scp script for moving emails from one server to another

Comments

7 comments

  • 24x7server
    Hello :), Yes, you can migrate your all email accounts mail from old server to new server with the following command.
    rsync -av --progress /home/account/mail/domain.com/* DestinationServerIP:/home/account/mail/domain.com/
    0
  • cPanelMichael
    Hello, Yes, it's possible to use a command like the one referenced in the previous response. Note you may want to run the following command on the destination server after copying the email data:
    /scripts/mailperm --username
    Thank you.
    0
  • albatroz
    is there a way to force the recreation of index files of Dovecot after this sync process?
    0
  • cPanelMichael
    is there a way to force the recreation of index files of Dovecot after this sync process?

    Yes, you can remove the index files via the following script, as they are regenerated upon login:
    # /scripts/remove_dovecot_index_files /scripts/remove_dovecot_index_files Utility to remove Dovecot index files. Available options: --user [cPanel username] Remove Dovecot index files from all email accounts setup under the specified cPanel user. Can be specified more than once, to process multiple users at once. --reseller [reseller username] Remove Dovecot index files from all email accounts setup under all the cPanel accounts owned by the specified Reseller. Can be specified more than once, to process multiple resellers at once. --all Remove Dovecot index files from all email accounts setup on the server. --verbose Prints the full paths of the files being removed. --help Prints this help text.
    Thank you.
    0
  • ulti
    Hi, after: rsync -av --progress /home/username/mail/domain.com/* DestinationServerIP:/home/username/mail/domain.com/ I have problem: No such user for all emails on domain.com /scripts/mailperm --username didn't help Any ideas ?
    0
  • cPanelMichael
    I have problem: No such user for all emails on domain.com

    Hello, You'd need to first re-create the email accounts via cPanel before syncing over the email data. Thank you.
    0
  • HostT
    For reference, here's the rsync command I used to copy mail from a remote server, to the server the command is running on:
    rsync -avzh --progress root@REMOTESERVERHOST:/home/account/mail/domain.com/* /home/account/mail/domain.com/
    0

Please sign in to leave a comment.