====== Migrate maildir mailboxes for Cyrus-Imap ======
{{tag>cyrus imap}}
The migration of maildirs managed by cyrus-imap is delicate because the cyrus.* files must be recreated correctly. Otherwise, cyrus completely ignores the mailboxes.
The technique is to copy the mailboxes in the mail directory (the one defined in //partition-default// in imapd.conf) and rebuild cyrus.* files via cyradm.
Follow the guide:
===== Stop cyrus-imap et log on the console =====
# /etc/init.d/cyrus-2.2 stop
# cyradm --user cyrus localhost
IMAP Password:
===== Recreate the mailboxes manually =====
This doesn't erase the content of the folders on the harddrive, it only declares the mailboxes in cyrus engine.
localhost> cm user.machin
localhost> cm user.truc
localhost> cm user.bidule
.....
===== Repair the metadata of all the mailboxes =====
The //reconstruct// command must be launch by cyrus user. Use **su** command as follow:
# su - cyrus -s /bin/sh -c 'for i in machin truc bidule; do /usr/lib/cyrus/bin/reconstruct -rkf user.$i;done'
user.machin
user.machin.pouet
user.machin.choupinou
user.machin.caribou
user.truc
user.truc.important
user.truc.tresimportant
user.truc.photosdemafemme
user.bidule
........
All the mailboxes should be recreated properly. Restart your cyrus-imap server and try to connect with any of the user.