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?
Thanks!
-- Jerry
On Thu, 20 Oct 2016 09:18:12 -0400 Jerry <jerry@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.
On October 20, 2016 at 4:45 PM Konstantin Khomoutov <flatworm@users.sourceforge.net> wrote:
On Thu, 20 Oct 2016 09:18:12 -0400 Jerry <jerry@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 callingdoveadm user *
and feeding its output to something likewhile read user; do
dest="/var/backup/dovecot/$user"; mkdir -p "$dest" && chown vmail:vmail "$dest"
&& chmod 0755 "$dest" dsync -u "$user" backup "maildir:$dest"
doneNote that you will only need this if you don't want to shut down Dovecot to copy its mail spool out.
You can also use doveadm backup -A maildir:%u/
Aki
On Thu, 20 Oct 2016 16:57:45 +0300 (EEST) Aki Tuomi <aki.tuomi@dovecot.fi> wrote:
[...]
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 callingdoveadm user *
and feeding its output to something likewhile read user; do
dest="/var/backup/dovecot/$user"; mkdir -p "$dest" && chown vmail:vmail "$dest"
&& chmod 0755 "$dest" dsync -u "$user" backup "maildir:$dest"
doneNote that you will only need this if you don't want to shut down Dovecot to copy its mail spool out.
You can also use doveadm backup -A maildir:%u/
Looks like doveadm
of my Dovecot 2.2 (Debian 8.0 Jessie) does not
support the "backup" subcommand. Is it a past-2.2 addition?
On October 20, 2016 at 5:11 PM Konstantin Khomoutov <flatworm@users.sourceforge.net> wrote:
On Thu, 20 Oct 2016 16:57:45 +0300 (EEST) Aki Tuomi <aki.tuomi@dovecot.fi> wrote:
[...]
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 callingdoveadm user *
and feeding its output to something likewhile read user; do
dest="/var/backup/dovecot/$user"; mkdir -p "$dest" && chown vmail:vmail "$dest"
&& chmod 0755 "$dest" dsync -u "$user" backup "maildir:$dest"
doneNote that you will only need this if you don't want to shut down Dovecot to copy its mail spool out.
You can also use doveadm backup -A maildir:%u/
Looks like
doveadm
of my Dovecot 2.2 (Debian 8.0 Jessie) does not support the "backup" subcommand. Is it a past-2.2 addition?
We aren't past 2.2 yet. But it should work with dsync -A backup as well I guess.
Aki
On Thu, 20 Oct 2016 17:38:31 +0300 (EEST) Aki Tuomi <aki.tuomi@dovecot.fi> wrote:
[...]
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 callingdoveadm user *
and feeding its output to something likewhile read user; do
dest="/var/backup/dovecot/$user"; mkdir -p "$dest" && chown vmail:vmail "$dest"
&& chmod 0755 "$dest" dsync -u "$user" backup "maildir:$dest"
doneNote that you will only need this if you don't want to shut down Dovecot to copy its mail spool out.
You can also use doveadm backup -A maildir:%u/
Looks like
doveadm
of my Dovecot 2.2 (Debian 8.0 Jessie) does not support the "backup" subcommand. Is it a past-2.2 addition?We aren't past 2.2 yet. But it should work with dsync -A backup as well I guess.
Oh, that's a documentation problem: the manual page doveadm(1) does not mention the word "backup" at all while running the command actually tells it's supported:
$ doveadm backup -A doveadm backup [-u <user>|-A] [-S <socket_path>] [-dfR] [-l <secs>] [-r <rawlog path>] [-m <mailbox>] [-n <namespace> | -N] [-x <exclude>] [-s <state>] <dest>
Good to know, thanks!
On Thu, 20 Oct 2016 16:57:45 +0300 (EEST) Aki Tuomi <aki.tuomi@dovecot.fi> wrote:
[...]
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 callingdoveadm user *
and feeding its output to something likewhile read user; do
dest="/var/backup/dovecot/$user"; mkdir -p "$dest" && chown vmail:vmail "$dest"
&& chmod 0755 "$dest" dsync -u "$user" backup "maildir:$dest"
doneNote that you will only need this if you don't want to shut down Dovecot to copy its mail spool out.
You can also use doveadm backup -A maildir:%u/
Could you please elaborate?
I have a typical "virtual users" setup where I do have
mail_home = /var/local/mail/%Ln mail_location = maildir:~/mail
and everything is stored with uid=vmail / gid=vmail (much like described in the wiki, that is).
I'd like to use a single call to doveadm backup -A ...
to back up the
whole /var/local/mail/* to another location (say, /var/backups/dovecot/)
so that is has the same structure, just synchronized with the spool.
(The purpose is to then backup the replica off-site).
I tried to call
doveadm backup -A maildir:/var/backups/dovecot/%u
and it created a directory "/var/backups/dovecot/%u" (with literal "%u", that is), created what appeared to be a single mailbox structure under it and after a while scared a heck out of me with a series of error messages reading
dsync(user1): Error: Mailbox INBOX sync: mailbox_delete failed: INBOX can't be deleted. dsync(user2): Error: Mailbox INBOX sync: mailbox_delete failed: INBOX can't be deleted. ...
for each existing user.
It appears that it luckily failed to delete anything in the source directory (though I have no idea what it actually tried to do).
Reading the doveadm-backup(1) multiple times still failed to shed a light for me on how to actually backup the whole maildir hierarchy for all existing users.
So, the question: how do I really should go about backing up the whole mailbox hierarchy in the case of virtual users?
On Thu, 20 Oct 2016 20:36:35 +0300, Konstantin Khomoutov stated:
On Thu, 20 Oct 2016 16:57:45 +0300 (EEST) Aki Tuomi <aki.tuomi@dovecot.fi> wrote:
[...]
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 callingdoveadm user *
and feeding its output to something likewhile read user; do
dest="/var/backup/dovecot/$user"; mkdir -p "$dest" && chown vmail:vmail "$dest"
&& chmod 0755 "$dest" dsync -u "$user" backup "maildir:$dest"
doneNote that you will only need this if you don't want to shut down Dovecot to copy its mail spool out.
You can also use doveadm backup -A maildir:%u/
Could you please elaborate?
I have a typical "virtual users" setup where I do have
mail_home = /var/local/mail/%Ln mail_location = maildir:~/mail
and everything is stored with uid=vmail / gid=vmail (much like described in the wiki, that is).
I'd like to use a single call to
doveadm backup -A ...
to back up the whole /var/local/mail/* to another location (say, /var/backups/dovecot/) so that is has the same structure, just synchronized with the spool. (The purpose is to then backup the replica off-site).I tried to call
doveadm backup -A maildir:/var/backups/dovecot/%u
and it created a directory "/var/backups/dovecot/%u" (with literal "%u", that is), created what appeared to be a single mailbox structure under it and after a while scared a heck out of me with a series of error messages reading
dsync(user1): Error: Mailbox INBOX sync: mailbox_delete failed: INBOX can't be deleted. dsync(user2): Error: Mailbox INBOX sync: mailbox_delete failed: INBOX can't be deleted. ...
for each existing user.
It appears that it luckily failed to delete anything in the source directory (though I have no idea what it actually tried to do).
Reading the doveadm-backup(1) multiple times still failed to shed a light for me on how to actually backup the whole maildir hierarchy for all existing users.
So, the question: how do I really should go about backing up the whole mailbox hierarchy in the case of virtual users?
I am experiencing the same problem as Konstantin. Is this s bug or expected behavior.
-- Jerry
On October 22, 2016 at 12:16 PM Jerry <jerry@seibercom.net> wrote:
On Thu, 20 Oct 2016 20:36:35 +0300, Konstantin Khomoutov stated:
On Thu, 20 Oct 2016 16:57:45 +0300 (EEST) Aki Tuomi <aki.tuomi@dovecot.fi> wrote:
[...]
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 callingdoveadm user *
and feeding its output to something likewhile read user; do
dest="/var/backup/dovecot/$user"; mkdir -p "$dest" && chown vmail:vmail "$dest"
&& chmod 0755 "$dest" dsync -u "$user" backup "maildir:$dest"
doneNote that you will only need this if you don't want to shut down Dovecot to copy its mail spool out.
You can also use doveadm backup -A maildir:%u/
Could you please elaborate?
I have a typical "virtual users" setup where I do have
mail_home = /var/local/mail/%Ln mail_location = maildir:~/mail
and everything is stored with uid=vmail / gid=vmail (much like described in the wiki, that is).
I'd like to use a single call to
doveadm backup -A ...
to back up the whole /var/local/mail/* to another location (say, /var/backups/dovecot/) so that is has the same structure, just synchronized with the spool. (The purpose is to then backup the replica off-site).I tried to call
doveadm backup -A maildir:/var/backups/dovecot/%u
and it created a directory "/var/backups/dovecot/%u" (with literal "%u", that is), created what appeared to be a single mailbox structure under it and after a while scared a heck out of me with a series of error messages reading
dsync(user1): Error: Mailbox INBOX sync: mailbox_delete failed: INBOX can't be deleted. dsync(user2): Error: Mailbox INBOX sync: mailbox_delete failed: INBOX can't be deleted. ...
for each existing user.
It appears that it luckily failed to delete anything in the source directory (though I have no idea what it actually tried to do).
Reading the doveadm-backup(1) multiple times still failed to shed a light for me on how to actually backup the whole maildir hierarchy for all existing users.
So, the question: how do I really should go about backing up the whole mailbox hierarchy in the case of virtual users?
I am experiencing the same problem as Konstantin. Is this s bug or expected behavior.
-- Jerry
I think it's not exactly a bug. But I think it should be expanded. I'll see if we can get that sorted.
Aki
On Sat, 22 Oct 2016 05:16:07 -0400, Jerry stated:
On Thu, 20 Oct 2016 20:36:35 +0300, Konstantin Khomoutov stated:
On Thu, 20 Oct 2016 16:57:45 +0300 (EEST) Aki Tuomi <aki.tuomi@dovecot.fi> wrote:
[...]
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 callingdoveadm user *
and feeding its output to something likewhile read user; do
dest="/var/backup/dovecot/$user"; mkdir -p "$dest" && chown vmail:vmail "$dest"
&& chmod 0755 "$dest" dsync -u "$user" backup "maildir:$dest"
doneNote that you will only need this if you don't want to shut down Dovecot to copy its mail spool out.
You can also use doveadm backup -A maildir:%u/
Could you please elaborate?
I have a typical "virtual users" setup where I do have
mail_home = /var/local/mail/%Ln mail_location = maildir:~/mail
and everything is stored with uid=vmail / gid=vmail (much like described in the wiki, that is).
I'd like to use a single call to
doveadm backup -A ...
to back up the whole /var/local/mail/* to another location (say, /var/backups/dovecot/) so that is has the same structure, just synchronized with the spool. (The purpose is to then backup the replica off-site).I tried to call
doveadm backup -A maildir:/var/backups/dovecot/%u
and it created a directory "/var/backups/dovecot/%u" (with literal "%u", that is), created what appeared to be a single mailbox structure under it and after a while scared a heck out of me with a series of error messages reading
dsync(user1): Error: Mailbox INBOX sync: mailbox_delete failed: INBOX can't be deleted. dsync(user2): Error: Mailbox INBOX sync: mailbox_delete failed: INBOX can't be deleted. ...
for each existing user.
It appears that it luckily failed to delete anything in the source directory (though I have no idea what it actually tried to do).
Reading the doveadm-backup(1) multiple times still failed to shed a light for me on how to actually backup the whole maildir hierarchy for all existing users.
So, the question: how do I really should go about backing up the whole mailbox hierarchy in the case of virtual users?
I am experiencing the same problem as Konstantin. Is this a bug or expected behavior.
Has anyone looked into this?
participants (3)
-
Aki Tuomi
-
Jerry
-
Konstantin Khomoutov