Tutorial on how to backup/restore cyrus

lkolchin at univ.haifa.ac.il lkolchin at univ.haifa.ac.il
Mon Sep 19 10:48:52 EDT 2005


Thank you guys for all your suggestions.

I've read this http://acs-wiki.andrew.cmu.edu/twiki/bin/view/Cyrus/Backup article.

I'm running SLES 9 with ReiserFS (noatime,acl,user_xattr,notail options)
configdirectory: /var/lib/imap
partition-default: /var/spool/imap

So lets say I convert my mailboxes.db to a text file like this:
su - cyrus -c "ctl_mboxlist -d" > /var/lib/imap/mailboxlist.txt

But next steps are very unclear:

Now I need to do a snapshot of the /var/lib/imap and /var/spool/imap to make proper backup.
I have a production environment so I think stopping the master process is very problematic.

A) So if anyone have some scripts with the snapshot feature who can share them, it would be nice to see them here.
B) Also any scripts with the minimal downtime for the cyrus are welcomed.
C) Any snapshot techniques (on reiserfs) are also very interesting and I like to here them.



P.S.
Thank you Vittorio for your script, but you are stopping the cyrus and I think it's very problematic in production environment. 


Best Regards,
Leon Kolchinsky


-----Original Message-----
From: Vittorio Muth [mailto:vmuth at hyperwave.com] 
Sent: Monday, September 19, 2005 3:54 PM
To: לאון קולצ'ינסקי
Cc: info-cyrus at lists.andrew.cmu.edu
Subject: Re: Tutorial on how to backup/restore cyrus

Hi Leon,

There is (one of many) way(s) how you can perfom a backup:

This script is only for the mailboxes (/var/spool/mail/imap in my case) and the files in /var/imap (for example: mailboxes.db)

<script>
#/bin/bash

#first do an unstable copy  (just to reduce the downtime of cyrus later)

	tmplog=/root/backupdir/tmpimaplog

	echo "start backup of imap..." >> $tmplog 2>&1

	echo "rsync of /var/imap" >> $tmplog 2>&1
	rsync -a --delete /var/imap /raid/mail_backup/tmpstore/varimap/ \	>> 
$tmplog 2>&1

	echo "rsync of /raid/mail/imap" >> $tmplog 2>&1
	rsync -a --delete /var/spool/mail/imap \
	/raid/mail_backup/tmpstore/varspoolimap/ >> $tmplog 2>&1


#now we do an rsync to "stabilize" the backup

#shut down cyrus
echo "stopping cyrus" >> $tmplog 2>&1
/usr/local/bin/cyrus stop >> $tmplog 2>&1


#sync with rsync to get a 'stable' backup

#
rsync -a --delete /var/imap /raid/mail_backup/tmpstore/varimap/ >> $tmplog 2>&1

rsync -a --delete /var/spool/mail/imap \ /raid/mail_backup/tmpstore/varspoolimap/ >> $tmplog 2>&1

#start cyrus
echo "starting cyrus..." >> $tmplog 2>&1 /usr/local/bin/cyrus start >> $tmplog 2>&1



#finally we move the whole temporary backup of the disk onto a tape:
#(requires an own script)

#do the rest... (like a normal backup, but with the archived paths in imap.list

echo "starting rest of backup..." >> $tmplog 2>&1

/root/backupdir/backup_imap

echo "...done." >> $tmplog 2>&1

# clean the temporary directory
rm -Rf /raid/mail_backup/tmpstore/*

</script>


I hope you can use it... If you have questions just feel free to ask.

best regards,

Vittorio




lkolchin at univ.haifa.ac.il wrote:
> Hello All,
>  
> Could you please point me to some good tutorial/manual on how to 
> backup and restore Cyrus DB and mailboxes.
>  
> Best Regards,
> Leon Kolchinsky
> 
> 
> ----------------------------------------------------------------------
> --
> 
> ----
> Cyrus Home Page: http://asg.web.cmu.edu/cyrus Cyrus Wiki/FAQ: 
> http://cyruswiki.andrew.cmu.edu List Archives/Info: 
> http://asg.web.cmu.edu/cyrus/mailing-list.html

--
____________________________________________________

Muth Vittorio . System Administration
Hyperwave R&D GmbH . Albrechtgasse 9 . A-8010 Graz

t: +43.316.820.918.607  f: +43.316.820.918.99
m: vmuth at hyperwave.com  w: http://www.hyperwave.com ____________________________________________________




More information about the Info-cyrus mailing list