Sysadmin Instructions on how to restore a file for a cyrus mail server

taken from: http://www.novell.com/coolsolutions/qna/1748.html


I deleted some email by mistake, and I need to restore from an available backup. We use Cyrus as the IMAP server and I have a backup of the directory /var/spool/imap/. What do I do now?

A:

Cyrus saves email in this directory:

/var/spool/imap/user/<user_name>/

There is a file for each message. File names consist of successive numbers followed by a dot. To prevent existing messages with an identical "number" from being overwritten, it is advisable to first create an additional folder in which to install the backup.

Use the webmail interface to create a new folder under the relevant user (e.g., backup). To do this, select Configuration -> Folder -> New folder. The system creates a new folder with the path

/var/spool/imap/user/<user_name>/backup/

(make sure not to create the folder manually. Otherwise, Cyrus will ignore it.)

Copy the messages to restore from your backup to the new folder. Restart your mailbox to make Cyrus acknowledge the new messages with

cyrus@slox:~> reconstruct -r user/<user_name>

or simply reconstruct without any option to restart all mailboxes.