Home / Postfix “file too large” error message

Postfix “file too large” error message

Running postfix on a CentOS mail server I got the following error message both in a returned email and also in the log file: "cannot update mailbox … error writing message: File too large". This post looks at the erorr message in the bounce email, the log files, and the solution to the error. This error will also affect postfix mail servers on Red Hat Enterprise Linux and probably other default installs of Postfix as well.

Testing the mailbox

I had copied over a mailbox file that was around 50MB in size from an old server to a new one, set up postfix and dovecot, and then tested the mail server was working correctly by sending an email to the mailbox from my email client.

The test message bounced back with the following error message in the body of the email:

This is the mail system at host example.com.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to <postmaster>

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<example@example.com>: cannot update mailbox /var/mail/example for
    user example. error writing message: File too large

I then checking the mail logs at /var/log/maillog and found the same error message:

Mar  6 09:27:07 www postfix/local[2508]: 4E3721BA0361: to=

The solution – mailbox_size_limit

There’s a postfix setting called "mailbox_size_limit" which sets the maximum file size for a mailbox. By default it is set to 50MB, hence my issue because the mailbox was already 50MB in size and postfix was not allowed to make it any bigger.

The solution to the "file too large" error is to modify this value in the /etc/postfix/main.cf file and either change it to a greater value, or set it to zero to have no limit. If the value is not already in the file then just add it to the end.

mailbox_size_limit = 0

Then you need to reload postfix – you can just reload, a full restart is not required:

/etc/init.d/postfix reload

and your new setting should take affect. In my case, I then resent the test email and it was successfully delivered into the mailbox.