System Disk Optimization-"/var/spool/Postfix/maildrop"

Source: Internet
Author: User
Tags rsync options

File cleanup

A server disk space alarm was reported recently. During the troubleshooting process, it was found that many small files had been accumulated under the "/var/spool/Postfix/maildrop" directory and wanted to be deleted directly at first, however, when you use RM to delete a file, the following message is displayed: "The parameter list is too long." Later, Rsync is used to identify the junk file:

# Create a temporary space-time folder mkdir/tmp/blankdir # Clear/var/spool/Postfix/maildroprsync-Av -- delete/tmp/blankdir/var/spool/Postfix/maildrop /# rsync options: # -- delete-before: the receiver deletes the object before transmission # -- Progress displays the transmission process during transmission # -- A archive mode, indicating that the object is transmitted recursively, and keep all file attributes # -- H keep hard-connected files # -- V detailed output mode # -- stats gives the transmission status of some files


    • Whether using rm or rsync, you must carefully check whether the file is useful before cleaning the file to avoid misoperation.
    • "/" Must be included after the path of the space-time directory using rsync "/"

Shortly after the files were cleared, a memory alarm was triggered. A large number of "Cron, Sendmail, and postdrop" processes were detected, at the same time, we also found that "/var/spool/Postfix/maildrop" has a large number of files generated, why?

So I started troubleshooting. After some "haidilao" operations, the truth finally surfaced:

When running cron in Linux, the output and warning information in the cron execution script are all sent to the cron owner in the form of an email. However, the Sendmail and Postfix operations in the client environment are not normal, as a result, the mail fails to be sent. All small files are stacked under the maildrop directory, and the conversion mechanism is not automatically cleared. Therefore, a large number of files have been accumulated in this directory for a year. View the information of man cron and you will know that it will be sent to the cron owner.

Now that it is caused by Cron, we should first kill "Sendmail and postdrop" to solve the pressing problem and then find a solution. The solution is as follows:

    • Change mailto = "root" in the/etc/crontab file to mailto = "" (This method is only valid for cron under crontab );

    • Add mailto = "" to the first line of all cron, so that no email will be sent when the current user's cron is executed.

      Mailto = ""***** Root/usr/sbin/Python/tmp/test. py

Then, clear the junk files under "/var/spool/Postfix/maildrop" again. Check that no files are generated and the problem is solved!

System Disk Optimization-"/var/spool/Postfix/maildrop"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.