Exporting and importing Zimbra LDAP data

The reasons can vary from an emergency restore of user accounts, to changing system architecture. In this Administrator’s PowerTip we will discuss how to export(dump) LDAP data to disk, and re import it.

Dumping LDAP Data to Disk
Exporting the data will place all of your LDAP Data into a single, movable .LDIF file.

su - zimbra
openldap/sbin/slapcat -f /opt/zimbra/conf/slapd.conf -l /tmp/ldap.ldif

Removing Current LDAP Data
WARNING!
DO NOT perform this on a production system. This procedure will wipe all usernames and passwords!

In order to import the LDAP data that we have exported, you will need to remove the current ldap data on the system.

su - zimbra
zmcontrol stop
ps auxx | grep slapd
(If ldap is still running, kill it)
rm -f openldap-data/*

Importing LDAP Data

su - zimbra
openldap/slapadd -f /opt/zimbra/conf/slapd.conf -l /tmp/ldap.ldif

Verify It’s Working

openldap/slapcat -f /opt/zimbra/conf/slapd.conf

or

zmprov gaa

These instructions have been testet successfully on my Zimbra 5.0 installation.

Source: http://www.zimbra.com/blog/