Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it OK to delete the files in the following folder?

/var/spool/clientmqueue

The above folder is more than 6GB and I want to free the disk space. I guess there are mails those failed to be delivered. I do not want those mails anymore.

share|improve this question

migrated from stackoverflow.com Oct 25 '09 at 4:49

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers

up vote 1 down vote accepted

Be careful. Some of the files may simply been messages that has delayed because of problems with the destination server and are about to be resent.

Try to see if you can flush the queue out first. If that does not work, start clearing the messages from that queue. With some mail systems (i.e. Postfix), there is a specific way to clear the queue. Here is one straight from the man page for postsuper:

       -d queue_id
          Delete one message with the named queue ID from the named mail queue(s) (default: hold, incoming, active and deferred).

          If a queue_id of - is specified, the program reads queue IDs from standard input. For example, to delete all mail with exactly one recipient user@example.com:

          mailq | tail +2 | grep -v '^ *(' | awk  'BEGIN { RS = "" }
              # $7=sender, $8=recipient1, $9=recipient2
              { if ($8 == "user@example.com" && $9 == "")
                    print $1 }
          ' | tr -d '*!' | postsuper -d -

Most of all, determine why the queue directory is so large. By default, mail systems like sendmail and/or postfix retain messages in the queue for about a week at a most, so having a large mail queue is definitely not normal unless the mail server is intend for high traffic volumes.

share|improve this answer
add comment

No you should not delete that folder.

The cause is usually bad spam filtering. You accept mail for non-existent email addresses then you bounce back mails if later turns out to be undeliverable. (A 6Gb size folder usually means thousands of mails.)

The problems is that you cannot distinguish between legitimate and non legitimate mails (there could be a transient error and a deliverable mail is being placed to that directory).

You should implement some (very) basic spam filtering (like not accepting mails from unresolvable sender domains) and in a week or two the size of that folder will be near zero.

(What I am saying is very easy to do with Postfix and many good docs is available. It is also doable with other MTAs though.)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.