Move Mailboxes

Discussion in 'Installation/Configuration' started by GCCM, Mar 22, 2022.

  1. GCCM

    GCCM Member

    Hi together

    I want to move my actual ISPCONFIG 3 Server to a new one.
    Productive Server still running. Also the new Server is installed like the first one.

    Now my Question:
    I can use over ISPCONFIG3 the Import Mailbox features. But the Mailbox self is never importet. Only the Mailbox entry on web.

    So now:
    Can someone explain me how to move the Mailboxes it self that customer do not lose any Mail?
    I don't know their passwords.
    I tried also already to move it over ssh with scp but it do not work.

    I use on both system newest version of ISPCONFIG 3 also Ubuntu 20.04 with newest "upgrades & dist-upgrades".

    About Websites etc. there is no help need also MySql etc. that already tested and working. Only on Mail i have no experience also no Idea anymore.

    I'm not very good at use console / Linux..

    Thank you for your assistance!! :)

    Best Regards
     
  2. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    use rsync from /var/vmail to /var/vmail. (assuming both source and destination servers both use courier, or both use dovecot)

    although, if you're trying to copy all services over from the old server to this new one, you might find it easier to buy the ispconfig migration toolkit and use ISPCopy
     
  3. GCCM

    GCCM Member

    Thank You.

    So i have to put in on commandline only this:
    rsync from /var/vmail to /var/vmail
    and it ask about server etc. or do i need to research about rsync? :)

    I would do it with ISPCopy. My biggest Problem is more, that on MySQL some thing was changed and now the Databases are not named correct. So i need anyway to do there some Manual Tasks. :)

    Sorry i know that i'm not known well actually about Linux but i'm learning :)
     
  4. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    you need to be able to ssh directly between the two servers.
    to do everything under /var/vmail, from the old server:
    Code:
    rsync -a /var/vmail/* <username>@<destination server hostname>:/var/vmail
    replacing values in < > with the correct details

    you could also do each maildomain folder individually.
     
  5. GCCM

    GCCM Member

    Thank you.

    I get now this message for each domain.
    rsync: recv_generator: mkdir "/var/vmail/domain.tld" failed: Permission denied (13)
    *** Skipping any contents from this failed directory ***
    rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1207) [sender=3.1.3]

    i already tried this one:
    How to write to remote side with sudo in rsync? - SysTutorials
    that i do not need sudo on destination server. But seems not working.
    Do you have also an idea for this? :)

    Thx you're very helping me! :)
     
  6. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    what user are you running rsync as? and what user are you using to ssh to the destination server?
     
  7. GCCM

    GCCM Member

    Actual Server: username --> sudo su (so i should be root)
    Destination Server: username (same as Actual)
    It is the username which is created on installation. i have no more users on the command line.

    On actual Server i run now this:
    [email protected]: rsync -a /var/vmail/* [email protected]:/var/vmail
     
  8. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

  9. GCCM

    GCCM Member

    hmm does not work.. should be the same as i already tried.. :(

    I still get the same message as before

    EDIT:
    Okay i have now better "informations". :)
    If i try with:
    sudo rsync -avz -e ssh /var/vmail/ [email protected]:/var/vmail

    i get now this:
    sending incremental file list
    rsync: failed to set times on "/var/vmail/.": Operation not permitted (1)
    rsync: failed to open "/var/vmail/.mailfilter", continuing: Permission denied (13)
    ./
    .bash_logout
    .bashrc
    .mailfilter
    .mailfilter~
    .profile
    rsync: recv_generator: mkdir "/var/vmail/domain.tld" failed: Permission denied (13)
    *** Skipping any contents from this failed directory ***
    rsync: recv_generator: mkdir "/var/vmail/domain.tld" failed: Permission denied (13)
    *** Skipping any contents from this failed directory ***
    domain.tld/
    domain.tld/
    rsync: mkstemp "/var/vmail/.bash_logout.fOXCex" failed: Permission denied (13)
    rsync: mkstemp "/var/vmail/.bashrc.j6rxkv" failed: Permission denied (13)
    rsync: mkstemp "/var/vmail/.mailfilter.hT7ZGx" failed: Permission denied (13)
    rsync: mkstemp "/var/vmail/.mailfilter~.BHIXJw" failed: Permission denied (13)
    rsync: mkstemp "/var/vmail/.profile.aURkhy" failed: Permission denied (13)
    rsync: recv_generator: mkdir "/var/vmail/domain.tld" failed: Permission denied (13)
    *** Skipping any contents from this failed directory ***
    domain.tld/
    rsync: failed to set times on "/var/vmail/mailfilters": Operation not permitted (1)
    rsync: recv_generator: mkdir "/var/vmail/domain.tld" failed: Permission denied (13)
    *** Skipping any contents from this failed directory ***
    mailfilters/
    domain.tld/
    rsync: recv_generator: mkdir "/var/vmail/domain.tld" failed: Permission denied (13)
    *** Skipping any contents from this failed directory ***
    domain.tld/

    sent 347,828 bytes received 2,069 bytes 77,754.89 bytes/sec
    total size is 587,435,501 speedup is 1,678.88
    rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1207) [sender=3.1.3]
     
    Last edited: Mar 22, 2022
  10. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    For that I would use ISPConfig Migration toolkit. https://www.ispconfig.org/add-ons/
    Did you succesfully copy the e-mail account to the new server, and now just want to copy the contents of users e-mail box? Then rsync should be enough here, if like @nhybgtvfr wrote both servers are running the same e-mail server application.
    On how to use rsync, read the man page,
    Code:
    man rsync
    or search the Internet for documentation. I think you need to make sure the owner of files stays the same, check what they are on old and new server. Set rsync to preserver owners and permissions and user on target host must have permission to write to /var/vmail. It may have to be root.
    But if what you wrote at the start, that you plan to "move server to a new one" then the above is useless work, since if you use Migration Tool it moves all accounts, data and passwords to the new server, including e-mail accounts and contents of mailboxes so you do not need to use ISPConfig "Import e-mail configuration tool" nor rsync the files.
     
  11. GCCM

    GCCM Member

    Hi Taleman

    Thank you. Yes if i got no MySQL Naming issue and have there some manual work, i would use the Tool. But since there is a Naming Problem, i need anyway to do some work there.

    If i try over ISPCONFIG3 Directly, all entry are created on new Server. But Data not transfered. Also if i do a resync.

    If i try to copy them Manually, i got the message above.. If someone can help me to fix the sudo issue, i think after it is fixed, i should be able to do the rest of the work.

    :)

    Best Regards
     
  12. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    What is this naming issue?
    You do not need to fix sudo issue. But if you want help with it explain what issue.
    It does not matter how you copy the files from old system to new, just make sure the owner and permission are correct on the target system. Examine what they are now on both systems. Use some way of copying files that you know how to use. For example make tar file on source, copy the tar file to target and extract there. Then check the owner and permission are correct.
    If you have sudo issues, read man pages and search for other documentation.
    Code:
    man sudo
    man sudoers
     
  13. GCCM

    GCCM Member

    The naming issue is, that the guy which i worked with created some databases manually and not over ISPCONFIG..
    So some databases got very strange Names and i want to correct it that users also be able to manage them over ISPCONFIG if they want to delete etc.

    i already explained the issue. If i want to copy over sudo i get "permission denied" like i postet above.
     
  14. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    That is because [email protected] does not have permission to write to /var/vmail.
    The sudo you use affects the rsync on the source server, but has no effect on the target server.
    You wrote you read https://www.systutorials.com/how-to-write-to-remote-side-with-sudo-in-rsync/ which explains how to get sudo on the target server, but in #5 you decide
    which is not true as you have yourself demonstrated.
     
  15. GCCM

    GCCM Member

    i configured on both servers for testing.. Same issue.

    may i worte about sudo wrong. the meaning was that i do not need to use like this:
    user login --> sudo...

    Sorry but your last 3 posts was not helpful.. it was more like trolling for me.
    Sorry that my motherlanguage is not english and i'm not perfect on it.. But 3 of 3 posts was nothing with help from yourside...
    The answers from nhybgtvfr helped me well but i ran into the last issue where i need help. If i can fix it with help, i think the project is done pretty fast.
     
  16. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    yes, you need to use sudo on the source machine, to run the command as root, so it has permissions to read /var/vmail.
    you also need sudo on the destination machine, so that the user on that machine also has permissions to write/modify /var/vmail
    which is why you need to use the rsync-path option, please read the link i included in post #8
    (or you need to create a password for the root use on the destination server, and allow ssh login as root. and then use 'root' as the username in your rsync command instead of just 'username')
     
  17. GCCM

    GCCM Member

    Thank you very much.
    I will try this evening the idea with "root" and not "username" i think, this could be the way to solve it. :) i will let you know if it worked or what message i got
     

Share This Page