Linux - cannot update mailbox /var/mail/root for user root. error writing messa ge: File too large

    早上在服务器上查问题的时候,偶然发现,在tail -f /var/log/mesage 中发现有这个日志报错,

cannot update mailbox /var/mail/root for user root. error writing messa ge: File too large

    Earlier today while looking into an issue on a CentOS Linux server I noticed an error message in the maillog file. The mail server running on this Linux server is Postfix and it appeared to have been complaining of the size of root’s mailbox located at /var/mail/root. When I first started investigating I figured I was going to see root’s mailbox at a size of 1GB or 2GB but I was surprised when looking into the issue that root’s mailbox was only about 48MB in size so at first I thought there might be another problem. After some digging around in /etc/postfix I figured out that Postfix limits the size of local mailboxes to 51200000 bytes or 48.8MB. Below is information on how I discovered the issue as well as how to modify the size that Postfix limits local mailboxes to.

    可以使用postconf -n来查看,相关的配置信息,如下;

[root@localhost ~]# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
inet_interfaces = localhost
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550

    该问题主要原因是因为在postfix配置文件main.cf.default

        mailbox_size_limit = 51200000(50M)

    也就是说当用户的对应的/var/mail/USERNAME 文件的大小不能超过50M 如果超出该值时可能会出现只能发送不能接受的情况。

解决方法:

    是重新设置 postfix main.cf.default 配置文件中对应 mailbox_size_limit=51200000

    修改为 mailbox_size_limit=0 把值改为零的情况下,就是不限制

  或:

[root@localhost ~]# postconf -e mailbox_size_limit=0

    在修改完postfix maincf.deafault 配置文件时,需要重新加载postfix  service  postfix  reload

 

posted @ 2022-01-27 18:35  zhangdaopin  阅读(352)  评论(2编辑  收藏  举报