Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Backing up Zimbra to a Windows XP machine?

  1. #11
    RyecoAaron is offline Senior Member
    Join Date
    Nov 2005
    Location
    Beloit, Wisconsin
    Posts
    71
    Rep Power
    9

    Default

    Quote Originally Posted by tezarin View Post
    This sounds like a great solution. Do you happen to have a step by step manual on how to use the rsync and zimbra together? I've never used rsync before...

    Edit - Also, can someone please recommend a good backup machine? What would the specs be? (Ram, hard drive, etc.)

    Thanks
    Here is the script I use. It is taken from the this forum (I think) with a few mods.

    Code:
    #!/bin/bash
    
    # Zimbra Backup Script
    # Requires ncftp to run
    # This script is intended to run from the crontab as root
    # Date outputs and su vs sudo corrections by other contributors, thanks, sorry I don't have names to attribute!
    # Free to use and free of any warranty!  Daniel W. Martin, 5 Dec 2008
    
    
    # Outputs the time the backup started, for log/tracking purposes
    echo Time backup started = $(date +%T)
    filedate="$(date +%m.%d.%Y)"
    before="$(date +%s)"
    
    # Live sync before stopping Zimbra to minimize sync time with the services down
    # Comment out the following line if you want to try single cold-sync only
    rsync -avHK --delete /opt/zimbra/ /backup/zimbra
    
    # which is the same as: /opt/zimbra /backup
    # Including --delete option gets rid of files in the dest folder that don't exist at the src
    # this prevents logfile/extraneous bloat from building up overtime
    
    # Now we need to shut down Zimbra to rsync any files that were/are locked
    # whilst backing up when the server was up and running.
    before2="$(date +%s)"
    
    # Stop Zimbra Services
    su - zimbra -c"/opt/zimbra/bin/zmcontrol stop"
    sleep 15
    
    # Kill any orphaned Zimbra processes
    ORPHANED=`ps -u zimbra -o "pid="` && kill -9 $ORPHANED
    
    # Only enable the following command if you need all Zimbra user owned
    # processes to be killed before syncing
    # ps auxww | awk '{print $1" "$2}' | grep zimbra | kill -9 `awk '{print $2}'`
    
    # Sync to backup directory
    rsync -avHK --delete /opt/zimbra/ /backup/zimbra
    
    # Restart Zimbra Services
    su - zimbra -c "/opt/zimbra/bin/zmcontrol start"
    
    # Calculates and outputs amount of time the server was down for
    after="$(date +%s)"
    elapsed="$(expr $after - $before2)"
    hours=$(($elapsed / 3600))
    elapsed=$(($elapsed - $hours * 3600))
    minutes=$(($elapsed / 60))
    seconds=$(($elapsed - $minutes * 60))
    echo Server was down for: "$hours hours $minutes minutes $seconds seconds"
    
    # Create a txt file in the backup directory that'll contains the current Zimbra
    # server version. Handy for knowing what version of Zimbra a backup can be restored to.
    su - zimbra -c "zmcontrol -v > /backup/zimbra/conf/zimbra_version.txt"
    # or examine your /opt/zimbra/.install_history
    
    # Display Zimbra services status
    echo Displaying Zimbra services status...
    su - zimbra -c "/opt/zimbra/bin/zmcontrol status"
    
    # Outputs the time the backup finished
    echo Time backup finished = $(date +%T)
    
    # Calculates and outputs total time taken
    after="$(date +%s)"
    elapsed="$(expr $after - $before)"
    hours=$(($elapsed / 3600))
    elapsed=$(($elapsed - $hours * 3600))
    minutes=$(($elapsed / 60))
    seconds=$(($elapsed - $minutes * 60))
    echo Time taken: "$hours hours $minutes minutes $seconds seconds"
    
    entry="zimbra daily:  $(date +%m.%d.%Y) - $(date +%H:%M:%S)"
    echo $entry >> /home/aaron/zimbra_log
    As far as a system to backup to, I use a system running OpenMediaVault with samba shares. I use an HP N40L microserver with two gigs of ram and four 2tb hds in raid 10. Very easy to setup and can easily saturate gigabit ethernet.

  2. #12
    tezarin is offline Senior Member
    Join Date
    Dec 2008
    Posts
    61
    Rep Power
    6

    Default

    Quote Originally Posted by RyecoAaron View Post
    Here is the script I use. It is taken from the this forum (I think) with a few mods.

    Code:
    #!/bin/bash
    
    # Zimbra Backup Script
    # Requires ncftp to run
    # This script is intended to run from the crontab as root
    # Date outputs and su vs sudo corrections by other contributors, thanks, sorry I don't have names to attribute!
    # Free to use and free of any warranty!  Daniel W. Martin, 5 Dec 2008
    
    
    # Outputs the time the backup started, for log/tracking purposes
    echo Time backup started = $(date +%T)
    filedate="$(date +%m.%d.%Y)"
    before="$(date +%s)"
    
    # Live sync before stopping Zimbra to minimize sync time with the services down
    # Comment out the following line if you want to try single cold-sync only
    rsync -avHK --delete /opt/zimbra/ /backup/zimbra
    
    # which is the same as: /opt/zimbra /backup
    # Including --delete option gets rid of files in the dest folder that don't exist at the src
    # this prevents logfile/extraneous bloat from building up overtime
    
    # Now we need to shut down Zimbra to rsync any files that were/are locked
    # whilst backing up when the server was up and running.
    before2="$(date +%s)"
    
    # Stop Zimbra Services
    su - zimbra -c"/opt/zimbra/bin/zmcontrol stop"
    sleep 15
    
    # Kill any orphaned Zimbra processes
    ORPHANED=`ps -u zimbra -o "pid="` && kill -9 $ORPHANED
    
    # Only enable the following command if you need all Zimbra user owned
    # processes to be killed before syncing
    # ps auxww | awk '{print $1" "$2}' | grep zimbra | kill -9 `awk '{print $2}'`
    
    # Sync to backup directory
    rsync -avHK --delete /opt/zimbra/ /backup/zimbra
    
    # Restart Zimbra Services
    su - zimbra -c "/opt/zimbra/bin/zmcontrol start"
    
    # Calculates and outputs amount of time the server was down for
    after="$(date +%s)"
    elapsed="$(expr $after - $before2)"
    hours=$(($elapsed / 3600))
    elapsed=$(($elapsed - $hours * 3600))
    minutes=$(($elapsed / 60))
    seconds=$(($elapsed - $minutes * 60))
    echo Server was down for: "$hours hours $minutes minutes $seconds seconds"
    
    # Create a txt file in the backup directory that'll contains the current Zimbra
    # server version. Handy for knowing what version of Zimbra a backup can be restored to.
    su - zimbra -c "zmcontrol -v > /backup/zimbra/conf/zimbra_version.txt"
    # or examine your /opt/zimbra/.install_history
    
    # Display Zimbra services status
    echo Displaying Zimbra services status...
    su - zimbra -c "/opt/zimbra/bin/zmcontrol status"
    
    # Outputs the time the backup finished
    echo Time backup finished = $(date +%T)
    
    # Calculates and outputs total time taken
    after="$(date +%s)"
    elapsed="$(expr $after - $before)"
    hours=$(($elapsed / 3600))
    elapsed=$(($elapsed - $hours * 3600))
    minutes=$(($elapsed / 60))
    seconds=$(($elapsed - $minutes * 60))
    echo Time taken: "$hours hours $minutes minutes $seconds seconds"
    
    entry="zimbra daily:  $(date +%m.%d.%Y) - $(date +%H:%M:%S)"
    echo $entry >> /home/aaron/zimbra_log
    As far as a system to backup to, I use a system running OpenMediaVault with samba shares. I use an HP N40L microserver with two gigs of ram and four 2tb hds in raid 10. Very easy to setup and can easily saturate gigabit ethernet.
    Thanks much for your very helpful reply. Do you by any chance know how much down time is needed (approx. time between the zimbra service stop and start command)?

    Also, in case of the emergency, if you need to swap the two machines, what other configurations do you need to do prior to that? (resolve.conf, host info, etc.). I am trying to set up a backup email server that can be put into service should the original box suddenly stops working.

    Thanks

  3. #13
    tezarin is offline Senior Member
    Join Date
    Dec 2008
    Posts
    61
    Rep Power
    6

    Default

    Can someone please answer my question if possible? Thanks

  4. #14
    tezarin is offline Senior Member
    Join Date
    Dec 2008
    Posts
    61
    Rep Power
    6

    Default

    Quote Originally Posted by RyecoAaron View Post
    This is what I do which minimizes downtime and it won't matter how long it takes to copy the backup to another computer:

    - rsync the zimbra directory while it is running to another location on the same server
    - stop zimbra
    - rsync --delete the zimbra directory to the same location used in the first step. This makes sure to backup the locked/changed files which is very important!
    - start zimbra
    - tar the location from the first step
    - copy tar file to backup computer
    1) Can someone please post the actual commands for step 1 and 3? I am planning to rsync to /home/backup/zimbra

    Would that be something like: rsync -avz servername: opt/zimbra /home/backup/zimbra ? Or I should add a trailing slash after /opt/zimbra? The reason I am asking this is because we will need to do a --delete and per the info I found on this page, we need to be careful and type the correct command: http://linux.about.com/library/cmd/blcmdl1_rsync.htm


    2) What other directoried on the server needs to be backed up? /etc or host file, etc?
    Thanks
    Last edited by tezarin; 11-14-2012 at 08:33 AM.

  5. #15
    tezarin is offline Senior Member
    Join Date
    Dec 2008
    Posts
    61
    Rep Power
    6

    Default

    someone please answer my question if possible? Thanks

  6. #16
    phoenix is offline Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Location
    Vannes, France
    Posts
    23,506
    Rep Power
    57

    Default

    Quote Originally Posted by tezarin View Post
    someone please answer my question if possible?
    You'll find the command in the forums and wiki if you search for them, look for "rsync".
    Regards


    Bill


    Acompli: A new adventure for Co-Founder KevinH.

  7. #17
    RyecoAaron is offline Senior Member
    Join Date
    Nov 2005
    Location
    Beloit, Wisconsin
    Posts
    71
    Rep Power
    9

    Default

    The commands for rsync are in the script. You should just be able to change the locations in the script. The time between starting and stopping zimbra on my system is around 6 minutes. /opt/zimbra is the only thing you need to backup. Swapping the machines in case of failure?? You can have a cold backup server setup with all settings identical. If one fails, you need to sync the cold backup server from your backup.

  8. #18
    tezarin is offline Senior Member
    Join Date
    Dec 2008
    Posts
    61
    Rep Power
    6

    Default

    Quote Originally Posted by RyecoAaron View Post
    The commands for rsync are in the script. You should just be able to change the locations in the script. The time between starting and stopping zimbra on my system is around 6 minutes. /opt/zimbra is the only thing you need to backup. Swapping the machines in case of failure?? You can have a cold backup server setup with all settings identical. If one fails, you need to sync the cold backup server from your backup.
    Thanks RyecoAaron, that is exactly what I am planning on doing. But was wondering which settings need to be identical and which files have to be backed up.

    Thanks in advance

  9. #19
    phoenix is offline Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Location
    Vannes, France
    Posts
    23,506
    Rep Power
    57

    Default

    Quote Originally Posted by tezarin View Post
    But was wondering which settings need to be identical and which files have to be backed up.
    Did you look at the script? All the files in the /opt/zimbra directory structure need to be backed up - this is also information that's in the forums and wiki articles covering a backup of ZCS.
    Regards


    Bill


    Acompli: A new adventure for Co-Founder KevinH.

  10. #20
    tezarin is offline Senior Member
    Join Date
    Dec 2008
    Posts
    61
    Rep Power
    6

    Default

    Quote Originally Posted by phoenix View Post
    Did you look at the script? All the files in the /opt/zimbra directory structure need to be backed up - this is also information that's in the forums and wiki articles covering a backup of ZCS.
    Yes, I saw the script and I understand that /opt/zimbra needs to be backed up but was also wondering what else on a typical CentOS box should be backed up and/or be identical?

    Let's say I buy a new machine and install OS on it, then install Zimbra and sync the contents of the /opt/zimbra. But I would still need to set up the spare box and issue the same IP, interfaces and host info. How should I do that so if I need to swap boxes, everything goes smoothly?

    Thanks

Page 2 of 3 FirstFirst 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 07-07-2012, 04:05 AM
  2. backing up zimbra OSE
    By ben1967 in forum Administrators
    Replies: 2
    Last Post: 02-07-2012, 09:48 AM
  3. Backups on a Windows Machine
    By danny.sierra@omtech.net in forum Administrators
    Replies: 0
    Last Post: 11-11-2008, 07:18 AM
  4. Trouble installing on Windows XP machine
    By 8ightlegs in forum Installation Help
    Replies: 2
    Last Post: 06-14-2008, 06:53 AM
  5. Replies: 2
    Last Post: 05-30-2008, 07:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •