Removing A Mailstore

Steps To Remove A Mailstore

Initial Checks

These are extended checks and steps one should follow when removing a mailstore from your environment. Sometimes mailstores will also be running other services and therefor you'll see some steps that would also handle that situation - i.e. mta or ldap replica service is also on the mailstore.

Confirm Users Are Off Mailstore

Confirm there are no users still on the mailstore in question:

# su - zimbra
$ source ~/bin/zmshutil
$ zmsetvars
$ ldapsearch -LLL -x -D $zimbra_ldap_userdn -w $zimbra_ldap_password -H $ldap_url -b "" | grep -i [hostname of host being removed]
$ zmprov -l gaa -s [hostname of host being removed]

Zmmailboxmove is one way to move users to other mailstores.

Confirm There Are No Other Dependencies On This Mailstore For Your Environment

Check what system accounts or services may be using that mailstore (also applies to MTA and LDAP):

Run this on all your mailstores:

$ zmlocalconfig | grep -i [hostname of host being removed]    

Checking that host-specific values no longer point to the boxes being removed - these would include:

  • zimbraSmtpHostname (applies to global, server, domain)
  • zimbraLogHostname (global only)
  • ldap_url (set in zmlocalconfig *per server*)
  • zimbraMtaAuthURL (global and per server)
  • zimbraMtaAuthHost (global and per server)
  • zimbraSpellCheckURL (global and per server)
  • zimbraNotebookAccount (global)
  • zimbraSpamIsNotSpamAccount (global)
  • zimbraSpamIsSpamAccount (global)
  • zimbraConvertdURL (global and per server)

The commands for retrieving this data would include:

$ zmprov gacf [attribute]                       # global configs
$ zmprov gs [server-name] [attribute]           # per server
$ zmprov gd [domain.com] [attribute]            # per domain
$ zmlocalconfig [attribute]                     # per server

And to update these for the new host/s you might of installed to replace the mailstore in question:

$ zmprov mcf [attribute]                        # global configs
$ zmprov ms [server-name] [attribute] [value]   # per server
$ zmprov md [domain.com] [attribute] [value]    # per domain
$ zmlocalconfig -e [attribute]="[value]"        # per server

On the host being removed from the environment, check the enabled services:

$ zmprov gs `zmhostname` zimbraServiceEnabled

Remove those services no longer desired on each box:

$ zmprov ms `zmhostname` -zimbraServiceEnabled mailbox
$ zmprov ms `zmhostname` -zimbraServiceEnabled mta
$ zmprov ms `zmhostname` -zimbraServiceEnabled ldap

And so forth.

Make sure the mailstore is not in the zimbraMailHostPool for any of the COSs. Get the ID for that server:

$ zmprov gs `zmhostname` zimbraId

example out would look like: zimbraMailHostPool: 777ed22f-9267-4b0d-81cb-51b677e3e6ae

Then, get the list of zimbraIDs that are part of any of the COS pools (Note: it is a good idea to store this list in case of a problem in the later steps, so they can be replaced):

$ zmprov gc default zimbraMailHostPool
  (repeat for other COSs)

Then, remove the zimbraIDs from those COS pools:

$ zmprov mc default -zimbraMailHostPool [zimbraID]

Check the zimbraIDs again, make sure it looks as expected:

$ zmprov gc default zimbraMailHostPool
  (repeat for other COSs)

Delete The Server From The Global Config

Delete the server from the configs:

$ zmprov deleteServer oldserver.domain.com

Update the ssh keys:

$ zmupdateauthkeys

Remove Zimbra

You could rerun the zimbra installer using the -u flag for uninstall:

./install.sh -u

Or manually remove zimbra by

  1. Manually removing the zimbra packages from your system
  2. Removing the /opt/zimbra
  3. Remove any 'zimbra' related files from /tmp


Verified Against: ZCS 6.0 Date Created: 1/7/2011
Article ID: https://wiki.zimbra.com/index.php?title=Removing_A_Mailstore Date Modified: 2012-03-29



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search