annotate doc/mail-storages.txt @ 817:86cf24da85f1 HEAD

Added :INDEX=<dir> for both Maildir and mbox to specify different location where to store index files. This would allow keeping mailboxes accessible through NFS but still keep the indexes in fast local disk. Did also some other related cleanups and minor fixes.
author Timo Sirainen <tss@iki.fi>
date Fri, 20 Dec 2002 09:53:51 +0200
parents ef64c9a50326
children 2512ad6fd9e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
430
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
1 Maildir
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
2 -------
429
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
3
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
4 We support Courier-compatible Maildir++. INBOX is the ~/Maildir directory,
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
5 all the other folders named as ".<folder>.<subfolder>.<etc>" under it, any
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
6 directories not starting with a dot are simply ignored. Deleting folders is
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
7 made atomic by renaming them as "..<folder name>" and deleting the
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
8 directory after that. So, all directories beginning with ".." are deleted
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
9 whenever they're noticed. Indexes are stored into each folder's root
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
10 directory.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
11
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
12 Custom flags saved using a..z letters as Maildir file flags. .customflags
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
13 file is then used to map the letters to names (a=0, b=1, etc).
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
14
430
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
15
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
16 mbox
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
17 ----
429
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
18
815
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
19 mbox storage requires an IMAP root directory where to store IMAP folders
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
20 and some other information. mbox file for INBOX is a special case which may
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
21 exist elsewhere in filesystem.
429
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
22
815
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
23 All files in the IMAP root directory not beginning with a "." are treated
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
24 as IMAP folders. Directories are treated as being IMAP subfolders.
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
25
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
26 Dovecot's indexes are stored in ".imap/<mailbox name>/" directories under
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
27 the folder directories.
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
28
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
29 MAIL environment for mbox is: <root folder>|<INBOX path>[:INBOX=<path>].
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
30 For example ~/Mail:INBOX=/var/mail/username.
430
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
31
817
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
32 indexes
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
33 -------
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
34
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
35 It's possible to specify different location for index files. This could be
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
36 wanted if mailboxes are accessed via remote filesystem (eg. NFS). Indexes
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
37 are mmap()ed and fcntl() locked, so they may not work too well with NFS, or
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
38 at least they'll work a bit slowly.
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
39
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
40 Indexes don't contain anything really important in them, so it doesn't
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
41 matter if they're lost or are out of sync. Dovecot just rebuilds or
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
42 refreshes them. This would allow creating a cluster where each computer
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
43 keeps the indexes locally while accessing the actual mailboxes via NFS. To
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
44 avoid unnecessarily rebuilding indexes all the time, the users should be
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
45 redirected to their primary server whenever possible.
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
46
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
47 Currently the only annoying thing with recreating indexes is that the
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
48 message UIDs will change, which may cause more traffic to clients, and
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
49 depending on client software may cause loss of some message-specific
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
50 settings. This will be fixed later by storing the UIDs permanently to
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
51 mailboxes.
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
52
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
53 Adding :INDEX=<dir> to MAIL environment overrides the default location. The
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
54 given directory must exist.
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
55
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
56
430
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
57 Detecting what to use
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
58 ---------------------
429
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
59
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
60 imap process detects the storage from MAIL-environment. It's preferred
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
61 format is "<storage>:<data>", for example "maildir:~/Maildir". It's anyway
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
62 allowed to be in pretty much any format as long as some of the storages
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
63 recognizes it as a valid data, so for example "MAIL=~/mail" is first
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
64 checked by maildir storage to see if it's valid maildir and mbox storage
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
65 after that.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
66
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
67 If the MAIL environment isn't given at all, all storages are gone through
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
68 and asked if they can find a usable mail folder. Also as a special case, if
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
69 MAILDIR environment exists, maildir storage is used with the directory
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
70 specified in it.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
71
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
72 Maildir storage is autodetected by checking if <directory>/cur/ exists and
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
73 we have rwx access to it. If directory isn't known, / and ~/Maildir are
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
74 checked. / is checked because we could be chrooted.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
75
815
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
76 mbox storage requires detecting INBOX location and IMAP root directory. If
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
77 MAIL environment points to file (+rw) it's treated as the INBOX file. If it
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
78 points to directory (+rwx) which contains .imap/ (+rwx), inbox (+rw) or
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
79 mbox (+rw) it's treated as IMAP root directory. If INBOX isn't known,
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
80 imap_root/inbox file is used by default. If root directory isn't known, we
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
81 try to find it from /, ~/mail or ~/Mail.
429
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
82
430
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
83
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
84 Files created by Dovecot
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
85 ------------------------
429
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
86
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
87 .subscriptions: One folder per line listing subscribed IMAP folders.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
88 There's only one of these files in the root mail directory (~/Maildir/ or
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
89 ~/mail/.imap/).
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
90
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
91 Then there's the per-folder files:
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
92
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
93 .imap.index: Fixed width mail index records.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
94
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
95 .imap.index.data: Variable width data, for example mail file name and
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
96 cached body, envelope, etc.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
97
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
98 .imap.index.log: Log file describing made changes. This file is used to
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
99 mark external changes (expunges and flag changes) temporarily until they're
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
100 synced into IMAP clients. If multiple Dovecots have the same folder open,
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
101 this can be a big speedup.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
102
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
103 .imap.index.tree: Binary tree used for looking up messages from .imap.index
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
104 file. This is used for both UID lookups and message sequence lookups.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
105 Sequences can be looked up directly from the index as long as no messages
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
106 have been expunged, but after that it gets slow unless it's compressed.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
107 Using this file however can keep the sequence lookups and expunges fast in
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
108 all situations without requiring compression.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
109
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
110 .customflags: Lists custom message flags. First line is header which
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
111 Dovecots check to see if the file has changed. Other lines list the flags
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
112 in format "<flag number> <flag name>". Currently there can be 26 different
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
113 flags (0..25).
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
114
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
115 .imap.index.log and .imap.index.tree files can be deleted without any data
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
116 loss, they're simply recreated/rebuilt when they're noticed missing.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
117
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
118 Deleting .imap.index and .imap.index.data files results in loss of message
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
119 UIDs. That may be a bad thing with some IMAP clients which store some data
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
120 about message locally and identifies the message by it's UID.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
121
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
122 Deleting .customflags results in loss of custom flag names for Maildir.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
123 With mbox the .customflags is simply recreated based on the flags listed
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
124 in the mbox file itself (ie. no data loss).