[Dovecot] Maildir configuration vs ZFS and snapshots...
I have a little tricky issue around here. First some background:
Every user is assigned their own ZFS filesystem, and it's mounted as /home/USER with a Maildir inside it. The there is a filesystem snapshot (read-only) taken automatically every day by the system. The idea is to allow users easy access to backup copies of their mail so that they can restore things themself..
For example this structure (somewhat abbreviated, some files/dirs removed):
/home/testson/ .zfs/ snapshot/ 2007-06-18/ Maildir/ cur/ new/ tmp/ .Trash/ cur/ new/ tmp/ Maildir/ cur/ new/ tmp/ .Trash/ cur/ new/ tmp/
Now,I can access the normal Maildir INBOX and folders nicely via Dovecot/IMAP. The thing is I'd like to be able to access the snapshot too via Dovecot/IMAP somehow. My first idea was to use Dovecots namespace feature like this in the config file:
namespace private {
separator = /
prefix = snapshot/
location =
maildir:~/.zfs/snapshot/2007-06-18/Maildir:CONTROL=~/.dovecot/control:INDEX=~/.dovecot/index }
This works great for the mail folders inside the Maildir - but not for the INBOX which isn't displayed at all... (Ie, under the "snapshot" prefix I only see "Trash" etc when looking at the folder from an IMAP client).
I think that I'd need to use the "INBOX=" option for Dovecot to see the top-level "new/cur/tmp" directories in the snapshot folder, but you can only have one INBOX if I'm not mistaken?
Any suggestions on how best to configure this?
- Peter
On Tue, 2007-07-03 at 16:20 +0200, Peter Eriksson wrote:
This works great for the mail folders inside the Maildir - but not for the INBOX which isn't displayed at all... (Ie, under the "snapshot" prefix I only see "Trash" etc when looking at the folder from an IMAP client).
Try "ln -s . .INBOX". I'll probably fix this for v1.1, but I already tried once for v1.0 and it got too messy.
Timo Sirainen wrote:
On Tue, 2007-07-03 at 16:20 +0200, Peter Eriksson wrote:
This works great for the mail folders inside the Maildir - but not for the INBOX which isn't displayed at all... (Ie, under the "snapshot" prefix I only see "Trash" etc when looking at the folder from an IMAP client).
Try "ln -s . .INBOX". I'll probably fix this for v1.1, but I already tried once for v1.0 and it got too messy.
It won't confuse Dovecot (and/or external mail programs accessing the Maildir directly like procmail and/or a directly accessing Pine for example)?
<resignated *sigh*> Oh how easy this had been if the Maildir standard had been sane and used real directories without dots, in a tree structure for the folder structure (and used .new/, .cur/ and .tmp/ for the folder data) - then I could have just put a pointer to "~/.zfs/snapshot" and have had *all* the snapshots show up under the "snapshot/" namespace more or less automatically :-). </>
- Peter
Greetings -
I'm intrigued by your suggestion of providing read-only access to
mail folders in the snapshots...
On 3 Jul 2007, at 15:20, Peter Eriksson wrote:
Now,I can access the normal Maildir INBOX and folders nicely via Dovecot/IMAP. The thing is I'd like to be able to access the snapshot too via Dovecot/IMAP somehow. My first idea was to use Dovecots namespace feature like this in the config file:
namespace private { separator = / prefix = snapshot/ location = maildir:~/.zfs/snapshot/2007-06-18/ Maildir:CONTROL=~/.dovecot/control:INDEX=~/.dovecot/index }
This works great for the mail folders inside the Maildir - but not
for the INBOX which isn't displayed at all... (Ie, under the
"snapshot" prefix I only see "Trash" etc when looking at the folder
from an IMAP client).
We are switching from the UW IMAP server with local disks to Dovecot
using a NetApp filer. The filer provides snapshots too, although
with a slightly different layout as the ".snapshot" directory appears
in each and every directory with its files and folders. For example:
~/Maildir/.snapshot/nightly.0/...
~/Maildir/.snapshot/nightly.1/...
~/Maildir/.snapshot/nightly.2/...
etc
where the ".0" suffixed directory is the most recent etc.
In your example your snapshots seem to be in directories named after
a specific date (when the snapshot was taken?). I was wondering if
you had some clever way of providing access to these; in your example
above you hard-code the names into the Dovecot configuration file,
which doesn't seem practical for a live system?
Basically I'm trying to mimic your setup and was wondering if you had
already solved the problem of getting down from your "snapshot"
directory through the intermediate level to the Maildir itself.
In passing, would I need to use a separate CONTROL and INDEX storage
area for these, or will the files for the snapshot folders live
happily alongside those for the live area? (I'm not too sure how the
organisation of these storage areas works when namespaces and
prefixes are concerned!)
Cheers, Mike B-)
-- The Computing Service, University of York, Heslington, York Yo10 5DD, UK Tel:+44-1904-433811 FAX:+44-1904-433740
- Unsolicited commercial e-mail is NOT welcome at this e-mail address. *
namespace private { separator = / prefix = snapshot/ location =
maildir:~/.zfs/snapshot/2007-06-18/Maildir:CONTROL=~/.dovecot/control:INDEX=~/.dovecot/index
}
... We are switching from the UW IMAP server with local disks to Dovecot using a NetApp filer. The filer provides snapshots too, although with a slightly different layout as the ".snapshot" directory appears in each and every directory with its files and folders. For example:
~/Maildir/.snapshot/nightly.0/... ~/Maildir/.snapshot/nightly.1/... ~/Maildir/.snapshot/nightly.2/... etc
where the ".0" suffixed directory is the most recent etc.
Uh.. I'n your case I think it would be quite easy. I think this should work:
namespace private { separator = / prefix = snapshot-0/ location = maildir:~/Maildir/.snapshot/nightly.0:CONTROL=~/.dovecot/control:INDEX=~/.dovecot/index
} namespace private { separator = / prefix = snapshot-1/ location = maildir:~/Maildir/.snapshot/nightly.1:CONTROL=~/.dovecot/control:INDEX=~/.dovecot/index
}
etc... You won't see the INBOX either (like me) unless you create the symlink suggested (.INBOX -> .) before taking the snapshots.
I think I tried setting up hierarchical namespaces but it didn't work (I would have liked to see snapshot/0, snapshot/1 etc).
In your example your snapshots seem to be in directories named after a specific date (when the snapshot was taken?). I was wondering if you had some clever way of providing access to these; in your example above you hard-code the names into the Dovecot configuration file, which doesn't seem practical for a live system?
In ZFS you can name your snapshots anything you like, it's just a tag that you select when you create it like this:
zfs snapshot -r andromeda/mail@2007-07-04
(-r = take snapshot of all the subfilesystems too. Each user has their own filesystem here).
In a real live situation I'd probably name them "yesterday" "last-week" or something more suitable for the hardcoding in the dovecot.conf file. Our I'd look at creating some kind of dynamic internal namespaces (requires hacking of Dovecot :-).
I'd really like to be able to present all the available snapshots over IMAP if possible. However, I'm a bit worried though that the mail client will walk thru all the mailboxes in all the snapshots when accessing the server though...
Basically I'm trying to mimic your setup and was wondering if you had already solved the problem of getting down from your "snapshot" directory through the intermediate level to the Maildir itself.
In passing, would I need to use a separate CONTROL and INDEX storage area for these, or will the files for the snapshot folders live happily alongside those for the live area? (I'm not too sure how the organisation of these storage areas works when namespaces and prefixes are concerned!)
You need to point the CONTROL and INDEX storage things outside of the readonly snapshots or Dovecot will complain when it wants to update the indexes...
- Peter
On Wed, 2007-07-04 at 12:21 +0200, Peter Eriksson wrote:
location =
maildir:~/Maildir/.snapshot/nightly.0:CONTROL=~/.dovecot/control:INDEX=~/.dovecot/index
..
location =
maildir:~/Maildir/.snapshot/nightly.1:CONTROL=~/.dovecot/control:INDEX=~/.dovecot/index
I don't think it's a good idea to point control and index paths to same place. It at least gives errors about expunged messages suddenly appearing again.
Maybe the easiest would be to have INDEX=MEMORY assuming that these mailboxes are rarely accessed (then again many clients do STATUS to all mailboxes..)
If you're using Dovecot's deliver so that dovecot-uidlist is always up-to-date, you can point the control files inside the snapshot. Otherwise they should have control.* directories.
I think I tried setting up hierarchical namespaces but it didn't work (I would have liked to see snapshot/0, snapshot/1 etc).
This should work in v1.1.
Greetings -
On 4 Jul 2007, at 11:21, Peter Eriksson wrote:
Uh.. I'n your case I think it would be quite easy. I think this
should work:namespace private { separator = / prefix = snapshot-0/ location = maildir:~/Maildir/.snapshot/nightly. 0:CONTROL=~/.dovecot/control:INDEX=~/.dovecot/index } namespace private { separator = / prefix = snapshot-1/ location = maildir:~/Maildir/.snapshot/nightly. 1:CONTROL=~/.dovecot/control:INDEX=~/.dovecot/index }
I've just been trying something like this and it does indeed work.
(What I was after was a way of not having to list each nightly.0,
nightly.1, etc separately, and instead be able to navigate down to
them: akin to your comments about the design of Maildir not being
convenient in this respect.)
etc... You won't see the INBOX either (like me) unless you create the symlink suggested (.INBOX -> .) before taking the snapshots.
This is indeed the case. One downside is that our mail clients then
see THREE inboxes :-( ... one is the account's real inbox, one the
symlink, and the third is the one in Outlook's "Outlook Today"
section of the list. (I hate the way this is always shown expanded
but the IMAP section shown collapsed: the number of people we get who
click on the Outlook Today inbox thinking it's the one on the IMAP
servers. :-(
I'd really like to be able to present all the available snapshots
over IMAP if possible. However, I'm a bit worried though that the
mail client will walk thru all the mailboxes in all the snapshots
when accessing the server though...
My testing has shown up a couple of problems...
- My mail client (Apple's "Mail") does indeed walk through the
snapshot hierarchy which, unfortunately leads to:- Mail duplicating its local cache of all the messages on my Mac's
hard disk, and - Dovecot creating index files for all the mailboxes in the snapshot.
- Mail duplicating its local cache of all the messages on my Mac's
The former takes time and disk space; the latter effectively doubles
the space used by someone's index files when you add a snapshot. And
of course if you have more than one snapshot namespace each has it's
own set of index files.
- Dovecot logs lots of error messages as my mail client traverses
the folders in the snapshot. This is because it is trying to use
utime() to update the timestamp of the directory in a read-only
filestore.
In passing, would I need to use a separate CONTROL and INDEX
storage area for these, or will the files for the snapshot folders
live happily alongside those for the live area? (I'm not too sure
how the organisation of these storage areas works when namespaces
and prefixes are concerned!)You need to point the CONTROL and INDEX storage things outside of
the readonly snapshots or Dovecot will complain when it wants to
update the indexes...
It looks like the CONTROL and INDEX settings for the snapshot
shouldn't use the same setting as is used by the live mailboxes. I
took the precaution of pointing them at a directory called SNAPSHOT
hanging off the normal INDEX storage location and found that
immediately below it I got a set of Maildirs for the folders in the
snapshot.
Thus if I had pointed the INDEX setting for the snapshot at the same
storage location as for the live folders I think I'd have had two
different sets of folders -- the live and its equivalent in the
snapshot -- sharing the same index file. If so I suspect the results
would not have been good! (The same goes for CONTROL files, of course.)
Cheers, Mike B-)
-- The Computing Service, University of York, Heslington, York Yo10 5DD, UK Tel:+44-1904-433811 FAX:+44-1904-433740
- Unsolicited commercial e-mail is NOT welcome at this e-mail address. *
participants (3)
-
Mike Brudenell
-
Peter Eriksson
-
Timo Sirainen