Backup Problems on OSX
I've recently inherited the administration duties of a small Zimbra Open Source server running on a G5 w/10.4.10. The system seems to run great, however what I am having no luck with is backing it up.
I'm not terribly familiar with Unix so the instructions at:
Backing up and restoring Zimbra (Open Source Version) - ZimbraWiki
..don't get me very far. I've tried to do a zmcontrol stop, and then run the cp command but get many errors such as:
cp: /opt/zimbra/postfix/spool/private/uucp: Operation not supported on socket
Plus, the cp process is still going, after over an hour, even though it's a simple installation with two mailboxes totaling 150mb worth of mail. On that G5, I can copy a 5gb file to another folder on the same drive and it'll zip right through.. so I'm confident that it's not a drive performance or memory issue.
OSX yells at me if I try to just use the Finder to copy the /opt/zimbra folder ("this folder has special permissions..."), and I'm guessing that the bulk of the actual mailbox storage (/opt/zimbra/store) is located in folders that only the "zimbra" user has access to. I'm logged into the OSX machine as an administrator. I don't want to Get Info and take control of those "zimbra user only shares" because I don't know if that'll hose the installation.
We use Retrospect 6.1 to pull data off our Mac clients and then back it up to tape. I assume that if I can't do a manual copy as the Administrator of the machine, Retrospect won't be able to copy the /opt/zimbra folder either.
I'm not an OSX expert by any stretch, but I'll give you a few tips:
1. Don't worry about the errors that say "Operation not supported on socket". Sockets are special Unix/Linux files and the cp command doesn't handle them. It is OK that they are not included in the backup, as they should be automatically recreated when Zimbra starts up.
2. Make sure you are not putting the backup file in the /opt/zimbra directory.
3. Try using the '-v' (verbose) option with your cp command. This should show you what file is being worked on, and may give you some idea of why it is not finishing.
4. You may want to also look into the tar and rsync commands (I think they are both available under OSX). They can also be very effective for creating backups from the command line.
I'm running a Zimbra 4.5.6 FOSS server on OS X 10.0.10, and this is the script I use to backup the data on the local machine to /zimbra-backup/.. This script stops zimbra, copies the data to another folder on the same machine using rsync (quicker than cp or tar, since it only copies changed data), and then once this script is done you can let your backup software do what it needs to this folder since it's all in a consistent state.
This is an "it works for me" script.
echo "`date` - Stopping Zimbra" >> $LOGFILE
su - zimbra -c '/opt/zimbra/bin/zmcontrol stop'
echo "`date` - rsync'ing /opt/zimbra to /zimbra-backup/zimbra" >> $LOGFILE
rsync -a -H --delete zimbra /zimbra-backup
echo "`date` - rync done, starting Zimbra in the background" >> $LOGFILE
su - zimbra -c '/opt/zimbra/bin/zmcontrol start' &
echo "`date` - local rsync copy done" >> $LOGFILE
echo "`date` - done" >> $LOGFILE
echo "-----------------------------------------------------" >> $LOGFILE
Thanks for the script. Unfortunately, it errors out with hundreds of permission denied errors.
rsync: send_files failed to open "/opt/zimbra/amavisd-new-2.4.3/db/cache-expiry.db": Permission denied (13)
Plus, when I run the script, it immediately asks me for a password (apparently because of the su zimbra part).
But I do like where the script is going. It sounds like it downs the server, creates a copy of the zimbra folder, and then I just point Retrospect to backup the zimbra-backup folder. I'll continue to tinker, but I think my current challenge will be to:
Fix this script's permission problem.
Get it to run without asking for a password.
Get it to run automatically every night at 10 PM, so when the Server Backup starts at 11PM it'll be done and ready.
Again I apologize for my lack of unix knowledge, the OSX GUI has certainly spoiled me..
Before running the script, get yourself into superuser ("sudo -i", using your account password)
Then make sure /zimbra-backup exists as a directory (mkdir /zimbra-backup)
Try running the script and see what goes.. since you're root, the "su"s shouldn't prompt for passwords.