Blob Blame Raw
With this rpm, you should usually find backups of your mailboxes.db
in /var/lib/imap/backup/. If you don't have them, for any reason,
you can recreate it like this.

Note: The scripts doesn't care with different hashing schemes of
the mailspool. Adjust as needed!
And please, check the permissions mailboxes.db after creating it.

#!/bin/sh
#

# stop cyrus-imapd
service cyrus-imapd stop

# backup existing mailboxes.db
mv /var/lib/imap/mailboxes.db /var/lib/imap/mailboxes.db.$$
find /var/spool/imap/?/user -maxdepth 1 -mindepth 1 | \
  while read i; do
    echo $(basename $i)
    echo "user.$i<\t>default<\t>$i<\t>lrswipcda<\t>cyrus<\t>lrswipcda" >> /tmp/newmboxlist.txt
  done

# we have everyone's base directory in /tmp/newmboxlist.txt, now we
# import the new list
/usr/lib/cyrus-imapd/ctl_mboxlist -u </tmp/newmboxlist.txt

# and reconstruct to get subfolders into the list
find /var/spool/imap/?/user -maxdepth 1 -mindepth 1 | \
  while read i; do
    /usr/lib/cyrus-imapd/reconstruct -rf user.$i
  done