backing up abacking up and restoring zimbra (open source version) - zimbra __ wikind restoring...

Upload: jacqueline-adams

Post on 02-Jun-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 Backing Up aBacking up and restoring Zimbra (Open Source Version) - Zimbra __ Wikind Restoring Zimbra (Open S

    1/6

    10/24/2014 Backing up and restoring Zimbra (Open Source Version) - Zimbra :: Wiki

    http://wiki.zimbra.com/wiki/Backing_up_and_restoring_Zimbra_(Open_Source_Version)#Another_option

    Zimbra: Email and collaboration for the Post-PC era

    Search

    User Help | Forums | Blog | Contact Us | Buy Zimbra

    LearnProductsCommunity

    SupportPartnersDownloadsAbout

    Backing up and restoring Zimbra (Open Source Version)

    From Zimbra :: Wiki

    - This article is a community contributionand may include unsupported customizations for network edition customers.

    If youwish to have a more automated backup feature, you should try the [Network Version of Zimbra.]

    Contents

    1 Preparing to Back Up2 Making a Backup3 Restoring4 Another option

    Preparing to Back Up

    Before we begin, make sure that you are logged in as a user that can perform the tasks outlined here.

    It is always good practice to backup your copy of Zimbra in the event of unforeseen circumstances.

    o prevent changes to any Zimbra databases during the backup processes you may wish to use:

    >su zimbra

    >zmcontrol stop

    to terminate Zimbra.

    If you get some kind of error, you may want to make sure that Zimbra has completely stopped by running:

    >ps auxww | grep zimbra

    and kill any left over processes such as the log.

    Making a Backup

    Make sure that the copy location has enough space to support your backup copy (i.e. the /tmp folder probably isn't the best location)

    http://wiki.zimbra.com/wiki/File:Article-alert.pnghttp://www.zimbra.com/partners/http://www.zimbra.com/products/http://wiki.zimbra.com/wiki/File:Article-alert.pnghttp://www.zimbra.com/about/http://www.zimbra.com/downloads/http://www.zimbra.com/partners/http://www.zimbra.com/support/http://www.zimbra.com/community/http://www.zimbra.com/products/http://www.zimbra.com/learn/http://www.zimbra.com/about/contact_us.htmlhttp://www.zimbra.com/about/contact_us.htmlhttp://blog.zimbra.com/http://www.zimbra.com/forums/http://help.zimbra.com/http://www.zimbra.com/products/http://www.zimbra.com/
  • 8/10/2019 Backing Up aBacking up and restoring Zimbra (Open Source Version) - Zimbra __ Wikind Restoring Zimbra (Open S

    2/6

    10/24/2014 Backing up and restoring Zimbra (Open Source Version) - Zimbra :: Wiki

    http://wiki.zimbra.com/wiki/Backing_up_and_restoring_Zimbra_(Open_Source_Version)#Another_option

    Since all of the components Zimbra needs are stored in the Zimbra folder itself, you can simply copy the folder to a safe location.

    It may be possible to create a cron job to do these tasks automatically. This it the command:

    >cp -rp /opt/zimbra [location of backup]/zimbra_backup

    Depending on your hardware and the amount of data contained in your Zimbra installation, this process can take a while.

    Note: It is a very good idea to tag your installation with the version/build of zimbra that will be backed up (ie 3.0.0_GA_156) and thedate of backup. You'll need this later.

    Restoring

    Before restoring, you should make sure that all of the processes associated with the damaged/failed Zimbra installation are terminateFailure to terminate all of the processes could have dire consequences. See "Preparing to Backup" for additional info.

    1) Rename your "broken" Zimbra installation.

    You may be able to scavenge data, if needed. If you simply do not want the old data, you can skip this part. This is how you do it:

    >mv /opt/zimbra /opt/zimbra_broken

    You may want to move it completly out of the /opt folder just to be safe. After that, copy your backup Zimbra installation to the /opt

    folder and name it "zimbra" by using the following commands:

    >cp -rp [location of backup]/zimbra_backup /opt

    >mv /opt/zimbra_backup /opt/zimbra

    2) Download a dummy copy of Zimbra

    Now, we need to know what build/version of zimbra you were running. If you followed the backup instructions above, then the backufolder should be tagged with the version/build you have backed up.

    You need to download the full install of the Zimbra version you were running. You may find all Zimbra releases at: Sourceforge.(http://sourceforge.net/project/showfiles.php?group_id=153217)

    If you don't know your version number, you can find it by performing the following steps:

    cd /opt/zimbracat .install_history

    Review the output and there should be an entry near the bottom that will show the last upgrade/install you did. It looks something likthis:

    1203106102: INSTALL SESSION START1203106124: UPGRADED zimbra-core-4.5.11_GA_1751.RHEL4-20080128130515.i386.rpm1203106126: UPGRADED zimbra-ldap-4.5.11_GA_1751.RHEL4-20080128130515.i386.rpm1203106134: UPGRADED zimbra-logger-4.5.11_GA_1751.RHEL4-20080128130515.i386.rpm1203106150: UPGRADED zimbra-mta-4.5.11_GA_1751.RHEL4-20080128130515.i386.rpm1203106154: UPGRADED zimbra-snmp-4.5.11_GA_1751.RHEL4-20080128130515.i386.rpm1203106167: UPGRADED zimbra-store-4.5.11_GA_1751.RHEL4-20080128130515.i386.rpm

    1203106171: UPGRADED zimbra-apache-4.5.11_GA_1751.RHEL4-20080128130515.i386.rpm1203106173: UPGRADED zimbra-spell-4.5.11_GA_1751.RHEL4-20080128130515.i386.rpm1203106173: INSTALL SESSION COMPLETE

    For non-rpm installations you might see .deb instead of .rpm but this should work on all platforms.

    3) Install the dummy copy of Zimbra

    Once you have downloaded the tar file, you will need to uncompress it by:

    >tar -xvzf [name of file].tgz

    his will create a folder in the directory named "zcs", open it and run the install script:

    http://sourceforge.net/project/showfiles.php?group_id=153217
  • 8/10/2019 Backing Up aBacking up and restoring Zimbra (Open Source Version) - Zimbra __ Wikind Restoring Zimbra (Open S

    3/6

    10/24/2014 Backing up and restoring Zimbra (Open Source Version) - Zimbra :: Wiki

    http://wiki.zimbra.com/wiki/Backing_up_and_restoring_Zimbra_(Open_Source_Version)#Another_option

    >cd zcs

    >./install.sh

    WARNING: Do not run the script with the -u option. You will remove all of your backup data & you must run the script as root, NOTZIMBRA.

    If all goes well, you will see the following:

    he Zimbra Collaboration Suite appears already to be installed.

    It can be upgraded with no effect on existing accounts,

    or the current installation can be completely removed prior

    to installation for a clean install.

    Do you wish to upgrade? [Y]

    Choose Y.

    he script will remove the existing packages, and install them again. The script will attempt to stop Zimbra Services and"UPGRADE FAILED - exiting". This is okay, simply rerun the script, and it will install normally.

    If you experience error 389, -1, connection refused errors, please search the Forums. These errors are covered extensively.

    4) Reset permissions

    If you are up and running now, you may have one more hurdle to overcome: permissions.

    You may need to reset the permissions on the message store by running the following:

    >chown -R zimbra:zimbra /opt/zimbra/store

    >chown -R zimbra.zimbra /opt/zimbra/index

    Also as root run the following:

    /opt/zimbra/libexec/zmfixperms

    Some scripts can be found here: http://wiki.zimbra.com/index.php?title=Open_Source_Edition_Backup_Procedure

    Another option

    Zimbra Backup and Restore "hot".[By Richardson Lima http://br.linkedin.com/in/richardsonlima ]

    BACKUP

    * Script 1* This script must be run as root, it runs the script runBackupAll.sh and also sends the entire backup to a second machine.

    echo "*******************************************************"echo "* Zimbra - Backup all email accounts *"echo "*******************************************************"echo""#echo Start time of the backup = $(date +%T)before="$(date +%s)"#echo ""ZHOME=/opt/zimbra

    http://br.linkedin.com/in/richardsonlimahttp://wiki.zimbra.com/index.php?title=Open_Source_Edition_Backup_Procedure
  • 8/10/2019 Backing Up aBacking up and restoring Zimbra (Open Source Version) - Zimbra __ Wikind Restoring Zimbra (Open S

    4/6

    10/24/2014 Backing up and restoring Zimbra (Open Source Version) - Zimbra :: Wiki

    http://wiki.zimbra.com/wiki/Backing_up_and_restoring_Zimbra_(Open_Source_Version)#Another_option

    ZBACKUP=$ZHOME/backup/mailboxecho "Generat ing backup files ..."su - z imbra -c "/opt /backup/SCRIPT_ZIBRA_BACKUP_ALL_ACCOUNTS/zimbra_backup_allaccounts .sh"echo "Sending files to backup all email accounts for Machine2 (10.0.0.X - CrossOver Cable on eth1 \o/ ) ..."rsync -avH $ZBACKUP root@ipaddress:/opt/zimbra_backup_accountsbefore2="$(date +%s)"#echo The process lasted = $(date +%T)# Calculating timeafter="$(date +%s)"elapsed="$(expr $after - $before)"hours=$(($elapsed / 3600))elapsed=$(($elapsed - $hours * 3600))minutes=$(($elapsed / 60))seconds=$(($elapsed - $minutes * 60))echo The complete backup lasted : "$hours hours $minutes minutes $seconds seconds"

    * Script 2zimbraBackupAllAccounts.sh

    ZHOME=/opt/zimbraZBACKUP=$ZHOME/backup/mailboxZCONFD=$ZHOME/confDATE=`date +"%a"`ZDUMPDIR=$ZBACKUP/$DATEZMBOX=/opt/zimbra/bin/zmmailboxif [ ! -d $ZDUMPDIR ]; thenmkdir -p $ZDUMPDIRfi

    echo " Running zmprov ... " for mbox in zmprov -l gaa`doecho " Genera ting files from backup $mbox ..." $ZMBOX -z -m $mbox getRe stURL "//?fmt=zip" > $ZDUMPDIR/$mbox.zipdone

    RESTORE

    * Script 3* This script must be run as root, it runs the script runRestoreAll.sh and also sends the entire backup to machine.zimbra_restore_allaccounts.sh

    echo "*******************************************************"echo "* Zimbra - Rest ore all email accounts *"echo "*******************************************************"echo ""#echo Start Time Restore = $(date +%T)before="$(date +%s)"#echo ""echo "Starting the process restore the backup files ..."su - zimbra -c "/opt/zimbra_backup_accounts/zimbra_restore_allaccounts.sh"before2="$(date +%s)"echo The process lasted = $(date +%T)# Calculating timeafter="$(date +%s)"elapsed="$(expr $after - $before)"hours=$(($elapsed / 3600))elapsed=$(($elapsed - $hours * 3600))

    minutes=$(($elapsed / 60))seconds=$(($elapsed - $minutes * 60))echo "The complete restore lasted : "$hours hours $minutes minutes $seconds seconds"echo "Process completed successfully!"

    * Script 4zimbra_restore_allaccounts.sh

    #!/bin/bashZHOME=/opt/zimbra#!/bin/bashZHOME=/opt/zimbra#ZBACKUP=$ZHOME/backup/mailboxZBACKUP=/opt/zimbra_backup_accounts/mailboxZCONFD=$ZHOME/confDATE=`date +"%a"`ZDUMPDIR=$ZBACKUP/$DATE

  • 8/10/2019 Backing Up aBacking up and restoring Zimbra (Open Source Version) - Zimbra __ Wikind Restoring Zimbra (Open S

    5/6

    10/24/2014 Backing up and restoring Zimbra (Open Source Version) - Zimbra :: Wiki

    http://wiki.zimbra.com/wiki/Backing_up_and_restoring_Zimbra_(Open_Source_Version)#Another_option

    ZMBOX=/opt/zimbra/bin/zmmailboxif [ ! -d $ZDUMPDIR ]; thenecho "Backups do not exist !"exit 255;fifor mbox in zmprov -l gaa`doecho " Restoring files from backup $mbox ..."$ZMBOX -z -m $mbox postRestURL "//?fmt=zip&resolve=reset" $ZDUMPDIR/$mbox.zipdone

    *** Soon I will be sending this improved script!Italic text

    erified Against:unknown and Richardson Lima Date Created:3/28/200Article ID:http://wiki.zimbra.com/index.php?title=Backing_up_and_restoring_Zimbra_(Open_Source_Version)

    Date Modified:05/13/2010

    Retrieved from "http://wiki.zimbra.com/index.php?title=Backing_up_and_restoring_Zimbra_(Open_Source_Version)&oldid=19753"Category: Backup and Restore

    Zimbra.com|Popular Searches|About Zimbra

    Learn

    What is Zimbra?BenefitsDemos and VideosIndustry SolutionsCustomersCase StudiesAwards

    Products

    Zimbra Collaboration ServerZimbra Cloud and Virtualization

    Zimbra Open SourceZimbra DesktopCompare ProductsPricingWhats NewDownloads

    Community

    ForumsDocumentationWikiBlog

    GallerySubmit BugRelease StatusDeveloper ZoneContribute

    Support

    Zimbra Support Program OverviewUser HelpZimbra Customer Support Portal

    Partners

    http://www.zimbra.com/partners/https://support.zimbra.com/supportlogin.phphttp://help.zimbra.com/http://www.zimbra.com/support/support_overview.htmlhttp://www.zimbra.com/support/http://www.zimbra.com/community/contribute.htmlhttp://www.zimbra.com/community/developer_zone.htmlhttp://pm.zimbra.com/http://bugzilla.zimbra.com/http://gallery.zimbra.com/http://blog.zimbra.com/http://wiki.zimbra.com/http://www.zimbra.com/community/documentation.htmlhttp://www.zimbra.com/forums/http://www.zimbra.com/community/http://www.zimbra.com/downloads/http://www.zimbra.com/products/whats_new.htmlhttp://www.zimbra.com/products/pricing.htmlhttp://www.zimbra.com/products/compare_products.htmlhttp://www.zimbra.com/products/desktop.htmlhttp://www.zimbra.com/products/zimbra-open-source.htmlhttp://www.zimbra.com/products/virtualization.htmlhttp://www.zimbra.com/products/network-collaboration-server.htmlhttp://www.zimbra.com/products/http://www.zimbra.com/learn/awards.htmlhttp://www.zimbra.com/learn/case-studies.htmlhttp://www.zimbra.com/learn/customer-list.htmlhttp://www.zimbra.com/learn/education-service-provider-business-solutions.htmlhttp://www.zimbra.com/learn/zimbra-demos-cheat-sheet.htmlhttp://www.zimbra.com/learn/zimbra-email-and-collaboration-benefits.htmlhttp://www.zimbra.com/learn/http://www.zimbra.com/learn/http://wiki.zimbra.com/wiki/Special:Categorieshttp://wiki.zimbra.com/index.php?title=Backing_up_and_restoring_Zimbra_(Open_Source_Version)&oldid=19753http://wiki.zimbra.com/index.php?title=Backing_up_and_restoring_Zimbra_(Open_Source_Version)http://wiki.zimbra.com/wiki/Category:Backup_and_Restore
  • 8/10/2019 Backing Up aBacking up and restoring Zimbra (Open Source Version) - Zimbra __ Wikind Restoring Zimbra (Open S

    6/6

    10/24/2014 Backing up and restoring Zimbra (Open Source Version) - Zimbra :: Wiki

    http://wiki.zimbra.com/wiki/Backing_up_and_restoring_Zimbra_(Open_Source_Version)#Another_option

    Zimbra Hosting ProvidersZimbra VARsZimbra Training ProvidersResources For Partners

    About

    CareersNewsEvents

    WebinarsMediaContact Us

    TwitterLinkedInFacebook

    Email SoftwareEmail HostingZimbra Mail ServerEmail Archiving and Compliance Software

    Calendar and CollaborationMicrosoft Outlook Alternative

    Zimbra for BlackBerry & iPhoneSecure Email & Anti SpamUnified Messaging

    Zimbra powers collaboration for the way you work. Zimbra connects people and information with unified collaboration software thatincludes email, calendaring, file sharing, activity streams, social communities and more. With technology designed for social, mobileand the cloud, Zimbra gives individuals the flexibility to work from virtually anywhere, through nearly every computer, tablet andmobile device.

    http://www.zimbra.com/products/unified-messaging.htmlhttp://www.zimbra.com/products/secure-email-anti-spam.htmlhttp://www.zimbra.com/products/secure-email-anti-spam.htmlhttp://www.zimbra.com/products/iphone-email.htmlhttp://www.zimbra.com/products/blackberry-enterprise-server.htmlhttp://www.zimbra.com/products/microsoft-outlook-thunderbird-email-client.htmlhttp://www.zimbra.com/products/calendar-collaboration.htmlhttp://www.zimbra.com/products/calendar-collaboration.htmlhttp://www.zimbra.com/products/email-archiving.htmlhttp://www.zimbra.com/products/email-archiving.htmlhttp://www.zimbra.com/products/email-server.htmlhttp://www.zimbra.com/products/deployment-options.htmlhttp://www.zimbra.com/http://www.facebook.com/Zimbrahttp://www.linkedin.com/companies/zimbrahttp://twitter.com/zimbrahttp://www.zimbra.com/about/contact_us.htmlhttp://www.zimbra.com/about/media.htmlhttp://www.zimbra.com/about/webinars.htmlhttp://www.zimbra.com/about/events.htmlhttp://www.zimbra.com/about/news.htmlhttp://www.zimbra.com/about/careers.htmlhttp://www.zimbra.com/about/http://www.zimbra.com/partners/resources_for_partners.htmlhttp://www.zimbra.com/partners/zimbra_training.htmlhttp://www.zimbra.com/partners/zimbra_vars.htmlhttp://www.zimbra.com/partners/zimbra_hosting.html