How to fix "File too large" error

Feb 10, 2020

A quick & dirty procedure about fixing “File too large” Postfix error.

less /var/log/maillog

Jan 28 16:49:11 localhost postfix/postdrop[27766]: warning: uid=0: File too large
Jan 28 16:49:11 localhost postfix/sendmail[27765]: fatal: root(0): message file too big

Check the limit

[root@localhost ~]# postconf message_size_limit
message_size_limit = 10240000

Modify the limit

Here is an example from 10 MB (default) to 50 MB. The attachment will be smaller than this limit (around 36 MB) because of MIME encoding which adds a 33% overhead.

With this command there is no need to restart Postfix service. If you manually change the line in /etc/postfix/main.cf then you have to restart the service with /etc/init.d/postfix restart command.

# postconf -e message_size_limit=52428800

You also need to change mailbox_size_limit (51200000 by default) in the config if the limit is higher than message_size_limit, if not you will get warning messages in /var/log/maillog.

# postconf -e mailbox_size_limit=52428800
postfix/local[2105]: fatal: main.cf configuration error: mailbox_size_limit is smaller than message_size_limit

Check again the limit

[root@localhost ~]# postconf message_size_limit
message_size_limit = 52428800

Test the new size

# truncate -s 35M test.txt
# echo "test attach" | mailx -s "subject" -a test.txt root@localhost
postfixlinuxlinuxmail

KVM Cheatsheet

Determine disk usage for a filesystem

comments powered by Disqus