Backuping a Cyrus Imap Server on openSuSE Linux 10.x

This article describes 2 easy ways to backuping up a Cyrus Imap Server.

 

 

System Description:

Standard SuSE linux 10.x server, installed in runlevel 3 with a working Cyrus Imap Server.

Systemrequirements:

Install the follwing packages via SuSE "YaST"

  • rsync

Now we start with the backup with reducing downtime:

Step 1 how to actually make the backup.

$>mkdir /usr/local/backup/imap         # make a backup dir
$>chmod -R 700 /usr/local/backup/imap  # change permisssions
...
$>rccyrus stop                          # stop the cyrus server
$>rsync -vaR /var/lib/imap /var/spool/imap /usr/local/backup/imap
$>rccyrus start                         # start the cyrus server

Step 2 how to actually make the backup.

Crontab entries under user "cyrus" !

# first we create the backup dir.
$>mkdir /usr/local/backup/mail_backup
$>chown cyrus.mail /usr/local/backup/mail_backup
# now we add the following crontab entrys under user "cyrus"
$>su cyrus
$>crontab -e
#
########################################
# crontab entry under user "cyrus"     #
# comments to: komaii[at]gmx.at        #
########################################
#
## Cyrus Imap backup start every day at 5:10
10 5 * * * /usr/lib/cyrus/bin/ctl_mboxlist -d > /usr/local/backup/mail_backup/backup-mboxlist
10 6 * * * /bin/tar -Pcjf /usr/local/backup/mail_backup/mail-data-backup.tar.bz2 /var/spool/imap
10 7 * * * /bin/tar -Pcjf /usr/local/backup/mail_backup/sieve-backup.tar.bz2 /var/lib/sieve
10 8 * * * /bin/tar -Pcjf /usr/local/backup/mail_backup/imap-backup.tar.bz2 /var/lib/imap/user

don`t forget to do a regular backup of the offsite copy!