cyrus management

su -l cyrus -c “/usr/lib/cyrus-imapd/ipurge -f -b 0 user.tmp” // cleaning mailbox
su -l cyrus -c ‘/usr/lib/cyrus-imapd/reconstruct -r user.tmp’ // mailbox recovery

cyradm –user cyrus –auth login localhost
…> dm user.tmp
deletemailbox: Permission denied
…> sam user.tmp cyrus c // here we set permission on mailbox user.tmp to user cyrus

su -l cyrus -c ‘/usr/cyrus/bin/ctl_cyrusdb -rx’ // db recovery attempt
su -l cyrus -c ‘/usr/cyrus/bin/ctl_cyrusdb -r’ // db recreation
su -l cyrus -c ‘/usr/cyrus/bin/ctl_mboxlist -d’ > /usr/cyrus/bin/dump // creating dump
su -l cyrus -c ‘/usr/cyrus/bin/ctl_mboxlist -u < /usr/cyrus/bin/dump’ // db recovery from dump
su -l cyrus -c ‘/usr/cyrus/bin/reconstruct -r user’ // reindexing

> to make a dump of all mailboxes to the text file:
su – cyrus -c “ctl_mboxlist -d” > /var/lib/imap/mailboxlist.txt
> to restore it:
su – cyrus -c “ctl_mboxlist -u” < /var/lib/imap/mailboxlist.txt
to make a regular backups /var/spool/imap/ and /var/lib/imap/, without stopping cyrus,
in this case there’s a danger of some data inconsistency and maybe some e-mails lost.
In case of disaster just copy mail directly from the backup to the mail store directory (/var/spool/imap/user/%username%),
And run:
/usr/lib/cyrus/bin/reconstruct -rf user/username
all quotas (in /var/lib/imap/quota/%firstletter of username%/)will not be reconstructed, so it should be done manually.
all subscription and seen info (in /var/lib/imap/user/%firstletter of username%/) will not be reconstructed, but it can be restored from the regular backup.

Leave a Reply

Your email address will not be published. Required fields are marked *