[SOLVED] Yet Another Backup Script for Community Version

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
xenonsky
Posts: 8
Joined: Sat Sep 13, 2014 3:04 am

[SOLVED] Yet Another Backup Script for Community Version

Post by xenonsky »

[quote user="TheChief79"]Last time i had to backup and restore my Zimbra 8.0.2. For the ldap database i used the tool mdb_copy which is included in zimbra.
So maybe this is a good way:
1. rsync zimbra to backup directory and exclude ldap db (maybe --exclude=/opt/zimbra/data/ldap/mdb/db/data.mdb)

2. Stop zimbra and copy the ldap database with mdb_copy (usage: mdb_copy srcpath dstpath). This will not copy the whole sparse file, it will copy the real size file.

3. Maybe rsync again

4. Start zimbra
mdb_copy worked great for me.
To restore on a new server:
1. I installed Zimbra (same verison) with ./install.sh -s

2. Moved the new Installation with mv /opt/zimbra /opt/zimbra_new

3. Copied the backup into /opt/zimbra

4. Started Zimbra

5. Ran the installer again with ./install.sh
Works![/QUOTE]


What should be correct syntax for running mdb_copy?
I put this line into my script:

/opt/zimbra/openldap/bin/mdb_copy /opt/zimbra/data/ldap/mdb/db /opt/zimbra/ldap-backup/`date +%s`
but I keep getting the following error when running the backup script:

mdb_env_copy failed, error 2 No such file or directory
m0ps
Posts: 9
Joined: Sat Sep 13, 2014 3:00 am

[SOLVED] Yet Another Backup Script for Community Version

Post by m0ps »

[quote user="xenonsky"]Thanks for the tips, I've just added the path to /etc/crontab and rebooted, then manually try to run a full backup and still got the same error:
Doing a hotsync of /opt/zimbra/ to /tmp/fakebackup/

rsync: writefd_unbuffered failed to write 4 bytes to socket [sender]: Broken pipe (32)

rsync: write failed on "/tmp/fakebackup/data/ldap/mdb/db/data.mdb": No space left on device (28)

rsync error: error in file IO (code 11) at receiver.c(301) [receiver=3.0.6]

rsync: connection unexpectedly closed (981 bytes received so far) [sender]

rsync error: error in rsync protocol data stream (code 12) at io.c(600) [sender=3.0.6]

rsync threw a hotsync error. this is not unusual, continuing...
any modification required for the original zmbak_v.0.8.sh script?
Thanks![/QUOTE]


rsync: write failed on "/tmp/fakebackup/data/ldap/mdb/db/data.mdb": No space left on device (28)

you have no space on your HDD
TheChief79
Posts: 10
Joined: Sat Sep 13, 2014 3:04 am

[SOLVED] Yet Another Backup Script for Community Version

Post by TheChief79 »

[quote user="xenonsky"]What should be correct syntax for running mdb_copy?
I put this line into my script:

/opt/zimbra/openldap/bin/mdb_copy /opt/zimbra/data/ldap/mdb/db /opt/zimbra/ldap-backup/`date +%s`
but I keep getting the following error when running the backup script:

mdb_env_copy failed, error 2 No such file or directory[/QUOTE]
It works for me running as root and as zimbra user: /opt/zimbra/openldap/bin/mdb_copy /opt/zimbra/data/ldap/mdb/db /tmp
ls -l /tmp

-rw-r--r-- 1 root root 1171456 Feb 14 10:19 data.mdb
xenonsky
Posts: 8
Joined: Sat Sep 13, 2014 3:04 am

[SOLVED] Yet Another Backup Script for Community Version

Post by xenonsky »

finally changing from: /opt/zimbra/openldap/bin/mdb_copy /opt/zimbra/data/ldap/mdb/db /opt/zimbra/ldap-backup/`date +%s`
to: /opt/zimbra/openldap/bin/mdb_copy /opt/zimbra/data/ldap/mdb/db /opt/zimbra/ldap-backup
and now everything works.


When restore the data.mdb just mdb_copy the other way should work then? without having the file size bloated to 85GB again, right?
TheChief79
Posts: 10
Joined: Sat Sep 13, 2014 3:04 am

[SOLVED] Yet Another Backup Script for Community Version

Post by TheChief79 »

Yes, just copy back the file. On restore i didnt use mdb_copy (made just normal copy), but it also should work.
When you start your new restored zimbra, the file will grow again over 80gig. mdb_copy is just useful to make a backup without the big ldap sparse file, but with real size file.
xenonsky
Posts: 8
Joined: Sat Sep 13, 2014 3:04 am

[SOLVED] Yet Another Backup Script for Community Version

Post by xenonsky »

Thanks guys for all the help here, my backup script is working with version 8.0.2
halley
Advanced member
Advanced member
Posts: 50
Joined: Fri Sep 12, 2014 11:48 pm

[SOLVED] Yet Another Backup Script for Community Version

Post by halley »

[quote user="xenonsky"]Thanks guys for all the help here, my backup script is working with version 8.0.2[/QUOTE]
friend,

post your backup script please?

thanks
xenonsky
Posts: 8
Joined: Sat Sep 13, 2014 3:04 am

[SOLVED] Yet Another Backup Script for Community Version

Post by xenonsky »

Attached is the modified script I'm using.
Changed RSYNC option from this:

RSYNC_OPTS="-aHK --delete --exclude=*.pid"
to this:

RSYNC_OPTS="-aHK --delete --exclude=data/ldap/mdb/db/data.mdb --exclude=*.pid"
Between 1st RSYNC and 2nd Quick RSYNC I added the following two lines to remove any existing previous copy of mdb files from /opt/zimbra/ldap-backup (may have to create this folder manually and change permission like "chmod 777" on ldap-backup folder) , then do the mdb_copy, and let 2nd quick RSYNC back it up.
rm /opt/zimbra/ldap-backup/*.mdb
/opt/zimbra/openldap/bin/mdb_copy /opt/zimbra/data/ldap/mdb/db /opt/zimbra/ldap-backup
Hope this works for everyone.
zmbak_v.0.8_works_for_8.0.3.txt
borngunners
Advanced member
Advanced member
Posts: 194
Joined: Sat Sep 13, 2014 12:31 am

[SOLVED] Yet Another Backup Script for Community Version

Post by borngunners »

I have tried to install the backup script and I am having trouble with the following mta dummy link wget http://ubuntu.lnix.net/misc/mta-dummy/m ... .0_all.deb
--2013-03-20">http://ubuntu.lnix.net/misc/mta-dummy/m ... .0_all.deb
--2013-03-20 10:02:09-- (try: 2) http://ubuntu.lnix.net/misc/mta-dummy/m ... .0_all.deb

Connecting to ubuntu.lnix.net (ubuntu.lnix.net)|81.26.52.3|:80... failed: Connection timed out.

Retrying.
--2013-03-20 10:03:14-- (try: 3) http://ubuntu.lnix.net/misc/mta-dummy/m ... .0_all.deb

Connecting to ubuntu.lnix.net (ubuntu.lnix.net)|81.26.52.3|:80... failed: Connection timed out.

Retrying.
--2013-03-20 10:04:20-- (try: 4) http://ubuntu.lnix.net/misc/mta-dummy/m ... .0_all.deb

Connecting to ubuntu.lnix.net (ubuntu.lnix.net)|81.26.52.3|:80... ^C
It looks like the link is not valid. Anywhere else I can get the mta dummy to install manually.
Thanks
LaFong
Outstanding Member
Outstanding Member
Posts: 221
Joined: Fri Sep 12, 2014 11:54 pm

[SOLVED] Yet Another Backup Script for Community Version

Post by LaFong »

[quote user="borngunners"]

It looks like the link is not valid. Anywhere else I can get the mta dummy to install manually.

[/QUOTE]

I think mta-dummy is gone from newer Ubuntu. Try this:

http://www.zimbra.com/forums/administra ... post215050

Alternately, you could install sendmail or xmail, or postfix (which comes with its own sendmail for compatibility), but you'll need to be sure to disable any of their startup services. Lastly, you can point the default sendmail to use the one that comes with Zimbra, How to "fix" system's sendmail to use that of zimbra - Zimbra :: Wiki.http://www.zimbra.com/forums/administra ... post215050"]

Post Reply