- First make sure the lzib plugins are enabled
https://discourse.mailinabox.email/t/speed-up-backups-or-migration-proccess/10644/4
Below 4 steps are quoted from the above URL:
- Change the file /etc/dovecot/dovecot.conf to add this lines (I added all of them at top of the file)
mail_plugins = $mail_plugins zlib
plugin {
zlib_save_level = 6 # 1…9; default is 6
zlib_save = gz # or bz2, xz or lz4
}
- change the file /etc/dovecot/conf.d/20-pop3.conf . You have to find this line
mail_plugins = $mail_plugins antispam
And change it to this line
mail_plugins = $mail_plugins antispam zlib
- Edit the file /etc/dovecot/conf.d/20-imap.conf
In the file you have to put the following:
protocol imap {
mail_plugins = $mail_plugins antispam imap_zlib
}
- Edit the file /etc/dovecot/conf.d/20-lmtp.conf
and put:
protocol lmtp {
mail_plugins = $mail_plugins sieve zlib
}
And then restart the server
- Copy the old mail dir
- Fix the file permissions and access
replace/home/user-data/mail/mailboxeswith the themaildirpath after the oldmaildirhas been copied
sudo chown -R mail:mail /home/user-data/mail/mailboxes
find /home/user-data/mail/mailboxes -type d -exec chmod 700 -R {} \;
find /home/user-data/mail/mailboxes -type f -exec chmod 600 {} \;
find /home/user-data/mail/mailboxes -type d -name Maildir -exec chmod 700 -R {} \;
find /home/user-data/mail/mailboxes -type f \( -name '.sieve' -o -name '.sieve.svbin' \) -exec chmod 644 {} \;
find /home/user-data/mail/mailboxes -type f \( -name 'dovecot-uidlist' -o -name 'dovecot-uidvalidity' -o -name 'dovecot.index*' -o -name 'maildirsize' \) -exec chmod 600 {} \;
find /home/user-data/mail/mailboxes -type f \( -name 'dovecot-uidvalidity.*' \) -exec chmod 444 {} \;
find /home/user-data/mail/mailboxes -type f \( -name 'subscriptions' \) -exec chmod 744 {} \;
find /home/user-data/mail/mailboxes -type f \( -name 'subscriptions' \) -exec sh -c 'echo "Junk" >> "$1"' -- {} \;
sudo chown -R mail:mail /home/user-data/mail/mailboxes
find /home/user-data/mail/mailboxes -type f -name '*dovecot*' -exec rm {} +
sudo service dovecot restart