Hi! After weeks of trying and with the generous assistance (and patience) of the people here I managed to upgrade my 3.0 installation to 4.5.3 release. Here are the steps I took:
1. Backup your working zimbra directory (3.0). As root:
cp -rp /opt/zimbra /backup
2. (Backup user accounts) Create LDAP db dump file. As zimbra:
su - zimbra
slapcat -l nameofdumpfile.ldif
3. (Backup mailbox ids from database) This is neccessary to properly re-inject the messages. The ids with their corresponding usernames from the previous installation will be used to tell zmlmtpinject the mail directories of each user from our backup. I believe this is information is saved in mailbox table therefore...:
su - zimbra
mysql zimbra
select * from mailbox
shall do the trick. Just find way to save the result in a text file or somewhere which you can use later.
I actually missed this step, good thing I have a list of our user accounts which I used in populating our zimbra ldap database before.
** BE SURE TO HAVE YOUR BACKUP AS MENTIONED ABOVE BEFORE CONTINUING ***
4. Install a fresh 4.5.3 zimbra. DO NOT CHOOSE UPGRADE!. This will overwrite everything in /opt/zimbra/ so be sure that you have your backup.
5. Import user accounts from LDAP dump file:
su - zimbra
slapadd -v -l /path/to/nameofdumpfile.ldif -c
6. Restore mails (using zmlmptinject). This is the tricky part since I didnt manage to backup the mailbox ids and what I have is a text file with the list of user accounts:
admin@mydomain.com
user1@mydomain.com
user2@mydomain.com
Checking the mails directory (/backup/zimbra/store/0/*) in my backup I noticed that mails in dir 0 was for admin, dir 1 was for user1 and so forth. That's why I was able to use this list to get the previous mailbox ids of our users (their order of appearance in the list) and use these ids as reference in importing their mails. (The following shell scripts requires the user accounts list as described above. Just modify the scripts below to use the result of mysql query in step no.3.)
As mentioned in this thread
the mails can be pre-proccessed before reinjecting to fix the dates. I downloaded and used the zimdates script posted in that thread and used it in this script (modify to suit the path to your backup directory):
#!/bin/bash
# define counter
accountCounter=1
# read user accounts file (accounts.txt). traverse through each line
cat accounts.txt | while read line; do
# cd to user's mail dir
cd /opt/backup/zimbra3.0_02062007/store/0/$accountCounter/msg/
# get content in current dir
contents=$(ls)
for loopFile in $contents
do
# run command
./zimdates.sh /backup/zimbra3.0_02062007/store/0/$accountCounter/msg/$loopFile/
done
# increment counter
let "accountCounter=$accountCounter + 1"
done
After fixing the date, inject the mails:
#!/bin/bash
# define counter
accountCounter=1
# read user accounts file (accounts.txt). traverse through each line
cat accounts.txt | while read line; do
# run command
/opt/zimbra/bin/zmlmtpinject -s ${line} -d /backup/zimbra3.0_02062007/store/0/$accountCounter/msg/* -r ${line}
# increment counter
let "accountCounter=$accountCounter + 1"
done
I hope this will be of help to anybody. Big thanks to john (jholder) and mark. Can the title of this thread be edited? the (mysql error) part in the title can be misleading. Thanks again!
Now if I can only "clean" the reinjected mails for spam...