separate file directory dovecot / iredmail

September 18, 2014 3.3k views

Did you install the tutorial iredmail atravéz contained right here, but now a situation has arisen. I'll need a lot of space to store files and email, but there is no possibility to increase only the size of disk space. I then thought about mounting a disc in my instance of S3, with only a directory for files and email. S3FS got to ride with, but to create the directory of email starts giving a lot of error in the dovecot log, because when using the vmail user, I believe that the Perm does not work, plus creates all files within the directory and -mail, no more proceeds with other creations and is in the LOG loop.
Does anyone know an alternative to using a directory without space limitations in a digital instance of the ocean? Or operate this situation I set up using S3 and have dovecot / iredmail create files in that directory?

6 comments
  • Could you post the error messages you're seeing in the log to a pastebin?

  • Problem solved with S3QL.

  • Hi @djmarcelomendes , I'm having the same problem with the disk space and thinking about mount S3 bucket to mail directory.
    Did you used S3FS + S3QL or only S3QL is enough? Is it working only with fresh install of iredmail or not? Thank you

  • Hello @lukasPRG. I used S3FS as directory to the folder iredmail files. I did the assembly of the S3 via S3FS and iredmail installation changed the directory for the S3 folder. Otherwise, if it is already done with the iredmail installation is to mount the S3 directory and then move all vmail files and change to the current folder name of iredmail, which is the vmail. Hugs

  • Thanks @djmarcelomendes . I tried s3ql and got some unknow error - needed restore from backup to work. Do you have please somewhere the tutorial or your note how get iredmail works with S3?
    Thank you.

  • Hello @lukasPRG. I do not have one tutorial. Over the issue of using the S3 is just to mount a directory on your machine, after which only point in iredmail the mounted directory. The error can be the size of the machine, which to mount the S3 must have at least 1GB. Hugs.

5 Answers

Good afternoon.
Follows the procedure and the log.
I created a folder:

[root@M2MXXXXXXXX /]# mkdir vmaildir
[root@M2MXXXXXXXX /]# chmod 777 vmaildir/
[root@M2MXXXXXXXX /]# chown vmail.vmail vmaildir/

Rode the S3 with S3FS

[root@M2MXXXXXXXX /]# s3fs mailm2mvmail /vmaildir -o default_acl=public-read -o use_cache=/tmp/cache -o allow_other

I put the folder in the database, in table MAILBOX.
When logging into the account created via Roundcube, entered as logged in, but was carrying and the log is dovecot.log loop. follows:

[root@M2MXXXXXXXX vmaildir]# tail -f /var/log/dovecot.log
Sep 18 19:41:56 auth-worker(15991): Info: mysql(bd.mydata.com.br): Connected to database vmail
Sep 18 19:41:56 imap-login: Info: Login: user=<marcelo@djmarcelomendes.com.br>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=15992, secured, session=<e9Omh18DCwB/AAAB>
Sep 18 19:42:03 imap(marcelo@djmarcelomendes.com.br): Info: Disconnected: Logged out in=29 out=453
Sep 18 19:42:03 imap-login: Info: Login: user=<marcelo@djmarcelomendes.com.br>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=15994, secured, session=<qNQciF8DmgB/AAAB>
Sep 18 19:42:05 dict: Info: mysql(bd.mydata.com.br): Connected to database vmail
Sep 18 19:42:05 imap(marcelo@djmarcelomendes.com.br): Info: Disconnected: Logged out in=70 out=667
Sep 18 19:42:08 imap-login: Info: Login: user=<marcelo@djmarcelomendes.com.br>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=15998, secured, session=<0xRbiF8DuQB/AAAB>
Sep 18 19:42:08 imap-login: Info: Login: user=<marcelo@djmarcelomendes.com.br>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=16000, secured, session=<C0JeiF8DvQB/AAAB>
Sep 18 19:42:11 imap(marcelo@djmarcelomendes.com.br): Warning: Created dotlock file's timestamp is different than current time (0 vs 1411083731): //vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/subscriptions
Sep 18 19:42:13 imap(marcelo@djmarcelomendes.com.br): Warning: Created dotlock file's timestamp is different than current time (0 vs 1411083733): //vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot.index.log
Sep 18 19:42:15 imap(marcelo@djmarcelomendes.com.br): Warning: Created dotlock file's timestamp is different than current time (0 vs 1411083735): //vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot-uidlist
Sep 18 19:42:18 imap(marcelo@djmarcelomendes.com.br): Warning: Created dotlock file's timestamp is different than current time (0 vs 1411083738): //vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot.index.log
Sep 18 19:42:26 imap(marcelo@djmarcelomendes.com.br): Warning: Created dotlock file's timestamp is different than current time (0 vs 1411083746): //vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot.index.log
Sep 18 19:42:26 imap(marcelo@djmarcelomendes.com.br): Error: Corrupted transaction log file //vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot.index.log seq 3: file size shrank (0 < 40) (sync_offset=40)
Sep 18 19:42:27 imap(marcelo@djmarcelomendes.com.br): Error: Index //vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot.index: Lost log for seq=1 offset=0
Sep 18 19:42:27 imap(marcelo@djmarcelomendes.com.br): Warning: fscking index file //vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot.index
Sep 18 19:42:30 imap(marcelo@djmarcelomendes.com.br): Error: fstat(//vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot-uidlist.lock) failed: Bad file descriptor
Sep 18 19:42:30 imap(marcelo@djmarcelomendes.com.br): Error: Maildir uidlist dotlock overridden: //vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot-uidlist
Sep 18 19:42:31 imap(marcelo@djmarcelomendes.com.br): Warning: Created dotlock file's timestamp is different than current time (0 vs 1411083751): //vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot-uidlist
Sep 18 19:42:32 imap(marcelo@djmarcelomendes.com.br): Error: Index //vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot.index: Lost log for seq=1 offset=0
Sep 18 19:42:32 imap(marcelo@djmarcelomendes.com.br): Warning: fscking index file //vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot.index
Sep 18 19:42:33 imap(marcelo@djmarcelomendes.com.br): Error: fstat(//vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot-uidlist.lock) failed: Bad file descriptor
Sep 18 19:42:33 imap(marcelo@djmarcelomendes.com.br): Error: Maildir uidlist dotlock overridden: //vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot-uidlist
Sep 18 19:42:34 imap(marcelo@djmarcelomendes.com.br): Error: Index //vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot.index: Lost log for seq=1 offset=0
Sep 18 19:42:34 imap(marcelo@djmarcelomendes.com.br): Warning: fscking index file //vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot.index
Sep 18 19:42:35 imap(marcelo@djmarcelomendes.com.br): Error: fstat(//vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot-uidlist.lock) failed: Bad file descriptor
Sep 18 19:42:35 imap(marcelo@djmarcelomendes.com.br): Error: Maildir uidlist dotlock overridden: //vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03//Maildir/dovecot-uidlist

By accessing the user directory, the files were created, more still does not work:

[root@M2MXXXXXXXX /]# ls -lt /vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03/Maildir/
ls: /vmaildir/var/vmail/vmail1/djmarcelomendes.com.br/m/a/r/marcelo-2014.09.16.03.53.03/Maildir/dovecot-uidlist.tmp: No such file or directory
total 4
-rw------- 1 vmail vmail   0 Sep 18 19:56 dovecot-uidlist.tmp
-rw------- 1 vmail vmail   0 Sep 18 19:56 dovecot-uidlist
-rw------- 1 vmail vmail  21 Sep 18 19:56 dovecot-uidlist.lock
-rw------- 1 vmail vmail   8 Sep 18 19:56 dovecot-uidvalidity
-rw------- 1 vmail vmail   8 Sep 18 19:56 dovecot.index.log
drwx------ 1 vmail vmail   0 Sep 18 19:56 tmp
-rw------- 1 vmail vmail 120 Sep 18 19:46 dovecot.mailbox.log
-rw------- 1 vmail vmail   0 Sep 18 19:46 subscriptions
-r--r--r-- 1 vmail vmail   0 Sep 18 19:42 dovecot-uidvalidity.541b6e18
drwx------ 1 vmail vmail   0 Sep 18 19:42 new
drwx------ 1 vmail vmail   0 Sep 18 19:42 cur

Tengo el mismo problema. Hago la conexión vía telnet, y cuando intento leer l bandeja de entrada aparece un error, y en el log tengo esto

Created dotlock file's timestamp is different than current time (0 vs 1493698947)

s3fs no es tan compatible con dovecot.

Lo resolviste?

  • Good Morning. Do not use S3 anymore. I ended up creating 2 mirrored machines via GlusterFS and mounted them on my MX servers. So I ended up with 4 machines, 2 data mirror, where the files and 2 machines are, MX1 and MX2 with the mirror mount of GlusterFS.

Éxito, problema resuelto!!! 😁 👍

En mi caso monté un Bucket en mi instancia de EC2, y sucede que ni postfix ni dovecot son compatibles con FUSE, por lo tanto no podía ni enviar ni recibir correo.

La solución es la siguiente:
Instalé Postfix y Dovecot como normalmente lo hago con los mailboxes en una carpeta de mi EBS, luego generé un trigger en postfix como se indica en este tutorial.

Lo que hace mi trigger es interceptar el correo entrante, copiarlo al Bucket de S3, y en el mailbox que está en el EBS, crea un link simbólico (ln -s) hacia el correo guarado en el bucket

De esa manera todos los correos se guardan en el bucket, y en el EBS solo tengo los links simbólicos que solo pesan 100 bytes cada uno.

Este es mi script

<?php
$nombre=time();
$n=rand(1000, 9999);
$nombre.=".$n.ip-52.43.244.137.eml";
$file = fopen("/path/mailbox/s3/$nombre", "a");

$fd = fopen("php://stdin", "r");
$email = "";
while (!feof($fd)) {
    $line = fread($fd, 1024);
    $email .= $line."\r";
}
fclose($fd);

fwrite($file, $email);
fclose($file);

shell_exec("ln -s /path/mailbox/s3/$nombre /path/mailbox/EBS/$nombre"); ?>

Problema resuelto 😀

Have another answer? Share your knowledge.