Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
 
Go Back   Zimbra - Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra - Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-28-2007, 07:37 AM
Starter Member
 
Posts: 1
Post FYI: ZCS NE backup to fuse/sshfs mount, worked.

I was able to get Zimbra Network Ed. Ver 4.5.6 to perform a successful backup to a fuse/sshfs mount point. The advantage of this approach is that the fact that the backup is to a remote server is completely transparent to Zimbra. If the network connection is broken during a backup, that backup run is ruined, but if the network connection breaks before the backup is run, then the backup will run and be stored on the local drive.

** First, you have to get fuse/sshfs installed and running, which is painless on some systems. It was painful on my CentOS 4.5 server, but I eventually got it working.

** Second, I logged in as Zimbra and ran
Code:
ssh-keygen -t rsa
Make sure that you use a blank password for this key -- it will be used for non-interactive remote secure login.

** Third, create an underprivileged account on your ssh-enabled network attached storage or computer (we'll call this host backuptarget) for zimbra to use, and add paste the contents of ~/.ssh/id_rsa.pub from you Zimbra server to ~/.ssh/authorized_keys on backuptarget, in your underprivileged account's home folder. We'll call this account "underpriv."

** Fourth, test your fuse/ssh login... As the Zimbra user on your Zimbra server, you should be able to login to your remote system without a password, using key authentication:
Code:
ssh underpriv@backuptarget
You should be able to login automatically, without any interaction. If it works, logout to return to your Zimbra server. Now test fuse/ssh:
Code:
sshfs underpriv@backuptarget:/home/underpriv /opt/zimbra/backup -o nonempty;
Without interaction, /opt/zimbra/backup should now reference underpriv's home folder on backuptarget. Now when Zimbra server performs a backup, the files will physically go there.

** Fifth, mount remote filesystem (automatically). I mount the remote filesystem ON TOP OF the default backup target, so if the network connection breaks, backups will still run locally. Ideally the network connection is up, and backups will all go remote. I created the following script and added it to zimbra user's crontab to run everyday one minute before the backup:
Code:
#!/bin/bash

# Test if it's already mounted
grep "/opt/zimbra/backup" /etc/mtab > /dev/null ;
if (($? != 0 )); then
        sshfs underpriv@backuptarget:/home/underpriv /opt/zimbra/backup -o nonempty;
fi
This script mounts the remote backup target on top of the local backup target, if the remote target is not already mounted. Without this check, you could mount the backuptarget twice. I did that _during_ a backup once, and hosed the backups on the backuptarget. Only way to get a successful backup after that was to delete them and start fresh, hence the safety check in the script.

That's it... That did it for me.
<Disclaimer>Of course, I recommend testing and not using it on a production system, etc.</Disclaimer>
Reply With Quote
Reply


Thread Tools
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

Zimbrablog.com




 

Search Engine Optimization by vBSEO 3.1.0