Migrating users between two Zimbra servers

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
rodrigoccurvo
Posts: 40
Joined: Fri Sep 12, 2014 9:55 pm

Migrating users between two Zimbra servers

Post by rodrigoccurvo »

Hi,
Is there an easy way to move an user from one Zimbra server to another? Say, I have server1.domain.com and server2.domain.com, both with working Zimbras and would like to move a given user 'testuser' from one to another with everything related to that user (e-mails, contacts, appointments, etc) without doind it by hand, is that possible?
Regards,
Rodrigo
bobby
Outstanding Member
Outstanding Member
Posts: 515
Joined: Fri Sep 12, 2014 10:01 pm

Migrating users between two Zimbra servers

Post by bobby »

n.b: this applies to the network edition only
i have yet to try out this hip trick myself, but assuming you have the same domain provisioned on server2.domain.com, you can zmbackup the account on server1.domain.com, copy that backup over, and zmrestore on server2.domain.com
something like this (you may want to check out zmbackup -h and zmrestore -h)
on server1.domain.com:

1. zmbackup -f -a account@domain.com -t /tmp/account-domain-backup

2. (tar-)zip everything under /tmp/account-domain-backup

3. copy the zip file to another host
on server2.domain.com:

4. unzip; make sure the unzipped path has r/w permissions

5. if domain.com is not already provisioned on server2.domain.com, use zmprov to create the domain (zmprov cd domain.com; restart tomcat)

6. zmrestore -ra -a account@domain.com -t /tmp/account-domain-backup

7. you may need to reset the restored user account's password (zmprov sp account@domain.com )
wherever:

8. login as account@domain.com on server2.domain.com
rodrigoccurvo
Posts: 40
Joined: Fri Sep 12, 2014 9:55 pm

Migrating users between two Zimbra servers

Post by rodrigoccurvo »

[quote user="17224bobby"]

something like this (you may want to check out zmbackup -h and zmrestore -h)

[/QUOTE]
Where are those tools? I couldn't find them in my M3 binary installation or in my M2 dev installation...
bobby
Outstanding Member
Outstanding Member
Posts: 515
Joined: Fri Sep 12, 2014 10:01 pm

Migrating users between two Zimbra servers

Post by bobby »

yeah i spoke too soon; those tools are part of the network edition
bobby
Outstanding Member
Outstanding Member
Posts: 515
Joined: Fri Sep 12, 2014 10:01 pm

Migrating users between two Zimbra servers

Post by bobby »

there is also a utility zmmailboxmove but it only works between servers in the same zimbra setup and afaik it only takes the mail, not the other stuff
bjared
Advanced member
Advanced member
Posts: 51
Joined: Fri Sep 12, 2014 10:12 pm

Migrating users between two Zimbra servers

Post by bjared »

I'm migrating from ZCS 4.0.0 (Network version) to 4.0.1 (Network version) on a different server:


On first server:

[zimbra@zimbra1 backup]$ zmbackup -f -a person@domain.com -t /opt/zimbra/backup/mydir

full-20060921.151033.194
On Second server

[zimbra@zimbra1 backup]$ zmrestore -ra -a person@domain.com -t /opt/zimbra/backup/mydir

Error occurred: no such account: Account ID for person@domain.com not found in backup
Do I have to match that funky ID for that user somehow before it works?
--Brian
marcmac
Elite member
Elite member
Posts: 2091
Joined: Fri Sep 12, 2014 9:53 pm

Migrating users between two Zimbra servers

Post by marcmac »

[quote user="bjared"]I'm migrating from ZCS 4.0.0 (Network version) to 4.0.1 (Network version) on a different server:


On first server:

[zimbra@zimbra1 backup]$ zmbackup -f -a person@domain.com -t /opt/zimbra/backup/mydir

full-20060921.151033.194
On Second server

[zimbra@zimbra1 backup]$ zmrestore -ra -a person@domain.com -t /opt/zimbra/backup/mydir

Error occurred: no such account: Account ID for person@domain.com not found in backup
Do I have to match that funky ID for that user somehow before it works?
--Brian[/QUOTE]
Is the backup done?
zmbackupquery -v -t /opt/zimbra/backup/mydir
bjared
Advanced member
Advanced member
Posts: 51
Joined: Fri Sep 12, 2014 10:12 pm

Migrating users between two Zimbra servers

Post by bjared »

Oh, I didn't realize it was going to run in the background. I got my shell prompt back fairly quickly. (I did think that was a little "too fast")
I thought it was either insanely fast, or the user's mailbox wasn't as big as I thought it was.
Hmm, zmbackupquery said it had completed. OK, I tried it again with a fresh backup (and made sure it had finished).
Evidently I can't have an account with that name already in the target server, because I got this:
[zimbra@zimbra1 backup]$ zmrestore -ra -a person@domain.com -t /opt/zimbra/backup/mydir

Error occurred: system failure: Account name has been reused by another account: person@domain.com
Alright, deleting that and then rerunning zmrestore seems to have worked.
Thanks for the zmbackupquery tip. :)
--Brian
bjared
Advanced member
Advanced member
Posts: 51
Joined: Fri Sep 12, 2014 10:12 pm

Migrating users between two Zimbra servers

Post by bjared »

Well, the mailbox I moved on the 21st wasn't seeing any new mail. After 3+ hours of debugging/testing of various things. (his e-mail is forwarded from Lotus Notes, so that was one variable.) I did a diff between the outputs of 'zmprov ga working_guy@domain.com' and 'zmprov ga broken_guy@domain.com' to discover the broken guy's MTA was still set to the old server! Doing the followin g command:
zmprov ma broken_guy@domain.com zimbraMailTransport lmtp:new-server.domain.com:7025
Then, I followed it up with:
postfix stop

postfix start
Voila, he can now get e-mail. Ugh.
--Brian
915Matt
Posts: 32
Joined: Fri Sep 12, 2014 10:15 pm

Migrating users between two Zimbra servers

Post by 915Matt »

I discovered the same when restoring a mailbox to a different zimbra server.
Post Reply