1

Topic: move mailbox storage to shared storage?

using latest build, Ubuntu 12.10, ldap.

I am using kvm vitalization and housing the email mailboxes in a VM makes it unmanageable to backup and restore the VM if it gets big.

I would like the mail server (VM) to be as small as possible and have the mail stored on a raid mass storage device.

What settings need to be changed to move the mailbox storage to a NFS or iscsi share?

thanks!

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: move mailbox storage to shared storage?

Just move the whole mailboxes (/var/vmail/vmail1 by default) to shared storage, and create a symbol link back (/var/vmail/vmail1).

Be careful, Dovecot has some special settings for shared NFS storage:
http://wiki2.dovecot.org/NFS

3

Re: move mailbox storage to shared storage?

Thanks for the info.

Do you think I would be better off using iscsi over NFS? Are there any issues with iscsi?

What do you think a safe size for the mailserver VM if I'm putting the mailboxes on a different server?

4

Re: move mailbox storage to shared storage?

ISCSI should be better, but it's recommended to do some basic testing yourself. Also, searching Dovecot mailing list should help a lot:
http://marc.info/?l=dovecot

nate wrote:

What do you think a safe size for the mailserver VM if I'm putting the mailboxes on a different server?

I have no idea at all. Below items will take much disk space:

- Operating system, of course
- Postfix queue directory. /var/spool/postfix/ by default.
- LDAP data directly. /var/lib/ldap/ by default.
- MySQL data directory. /var/lib/mysql/ by default.
- Webmail temp directory, used for uploading attachments. roundcubemail/temp/ by default.
- Log files. /var/log/ by default.

So:
- If you don't have many users, LDAP/MySQL/Webmail temp directory should be small.
- If you don't send bulk emails, e.g. newsletter, Postfix queue size should be small.
- If you have proper log rotate settings, log files (/var/log/*) should be small.

Just my 2 cents, hope it helps. smile

5

Re: move mailbox storage to shared storage?

Thank you ZhangHuangbin. In the dovecot docs it says using NFS I should move the index files to local storage. Do you think it is necessary for iscsi?

iredmail is setup using maildir right not mbox?

thanks for your replies. I find your input very helpful.

6

Re: move mailbox storage to shared storage?

nate wrote:

In the dovecot docs it says using NFS I should move the index files to local storage. Do you think it is necessary for iscsi?

ISCSI is still a network storage, so it's a good idea to store Dovecot index files on local server to speed up IMAP operations.

To separate Dovecot index files in iRedMail, just modify mail_location setting in dovecot.conf. For example, default setting is:

mail_location = maildir:/%Lh/Maildir/:INDEX=/%Lh/Maildir/                                                               

Here %Lh will be expanded to maildir path, since the maildir path will be pointed to a network storage, you should modify INDEX= to point to local server. For example:

mail_location = maildir:/%Lh/Maildir/:INDEX=/opt/dovecot/indexes/%Ld/%Lu/

Then all Dovecot index files will be stored in /opt/dovecot/indexes/[domain]/[user]/.
%L is used to convert %d and %u to lower cases. Reference: http://wiki2.dovecot.org/Variables

nate wrote:

iredmail is setup using maildir right not mbox?

Yes, Maildir/ format by default. mbox format is not supported in iRedMail.

7

Re: move mailbox storage to shared storage?

In creating the symbolic link. Do I need to delete the dir  /var/vmail/vmail1 ?

I'm running this command

ln -s /svr  /var/vmail/vmail1  from the /svr directory

/svr is my iscsi share mount. I add the link then reboot dovecot , send a test email,check the filesystem but its still adding the new mail to the local drive.

Any idea on what I might be doing wrong?

8

Re: move mailbox storage to shared storage?

You should delete (or move) old /var/vmail/vmail1 first, then create symbol link point /svr to /var/vmail/vmail1.

9

Re: move mailbox storage to shared storage?

I made the symlink. I can navigate the directories via terminal, etc.

ls -l
drwxr-xr-x 2 root  root  4096 Jul  2 14:24 backup
drwx------ 2 vmail vmail 4096 Jul  2 14:23 sieve
lrwxrwxrwx 1 root  root    11 Jul  5 12:03 vmail1 -> /srv/vmail1

But when I try to login roundcube. Roundcube gives me a loin error "Connection to imap server failed". So Dovecot isn't liking the symbolic link. I stopped both dovecot and postfix before creating the symbolic link too. I made the symbolic link using sudo su , ubuntu 12.04 . And I moved the directories 1st then deleted them , then created the symlink as you suggested.

Any idea on what I might be doing wrong?

10

Re: move mailbox storage to shared storage?

I figured out why, aits a permission problem. but I don't know how to fix it yet.

Jul 05 13:07:02 imap(test@mydomain.com): Error: chdir(/var/vmail/vmail1/mydomain.com/t/e/s/test-2012.07.02.14.16.26//) failed: Permission denied (euid=1001(vmail) egid=1001(vmail) missing +x perm: /var/vmail/vmail1/mydomain.com, dir owned by 0:0 mode=0700)

11

Re: move mailbox storage to shared storage?

sudo chmod 777 -R vmail1

that fixed it. Its wide open. I'm pretty sure I need to change the owner to vmail? and permission to 0660? I see that user in /etc/passwd.

12

Re: move mailbox storage to shared storage?

nate wrote:

sudo chmod 777 -R vmail1

Please set it to 0700, owner is "vmail:vmail".