On Thu, 20 Oct 2016 09:18:12 -0400 Jerry <je...@seibercom.net> wrote:
> I am running Dovecot with Postfix on a FreeBSD machine. There are > problems with the drive and I cannot depend on it. Dovecot saves all > mail in IMAP format. I want to back up the mail folders, install a new > HD, install the latest FreeBSD OS and then reinstall my programs. > Reinstalling Dovecot is simple, but how do I reinstall the IMAP > folders? Can Dovecot backup the folders onto a CD and then import them > when I reinstall it? My mail is kept under “/var/mail/vmail”. Should I > just back up that entire directory structure and then restore it > later? That should work (just make sure Dovecot is not running to not have a race between your backup software and the IMAP server and clients). Alternatively you can use `dsync` to perform backup with a native Dovecot tool. It's able to sync mailboxes of any Dovecot user -- including synchronizing a mailbox to an empty (yet) spool. You'll need to do a bit of shell scripting which would spin around calling `doveadm user *` and feeding its output to something like while read user; do \ dest="/var/backup/dovecot/$user"; mkdir -p "$dest" && chown vmail:vmail "$dest" \ && chmod 0755 "$dest" dsync -u "$user" backup "maildir:$dest" \ done Note that you will only need this if you don't want to shut down Dovecot to copy its mail spool out.