0

My CentOS system, used for PHPList, accumulates incoming mail in this path: /var/qmail/mailnames/example.com/noreply/Maildir/cur

There used to be hundreds of thousands of emails in this mailbox, they were bounce emails meant for bounce processing by PHPList, but PHPList was choking on them. So I used cleanup-maildir script to mass-remove emails. Now I see that the cur directory is empty, (ls -l weirdly takes about 10 seconds to return with "total 0") and yet it shows a large size. My Plesk panel also shows that the mail account is still occupying many GB. What do I need to do?

[root@server-1012263-1 cur]# pwd
/var/qmail/mailnames/example.com/noreply/Maildir/cur
[root@server-1012263-1 cur]# ls -al
total 72520
drwx------  2 popuser popuser 74199040 Jan  8 18:10 .
drwx------ 10 popuser popuser     4096 Jan  8 18:15 ..
[root@server-1012263-1 cur]# cd ..
[root@server-1012263-1 Maildir]# pwd
/var/qmail/mailnames/example.com/noreply/Maildir
[root@server-1012263-1 Maildir]# ls -al
total 81432
drwx------ 10 popuser popuser     4096 Jan  8 18:20 .
drwx------  6 popuser popuser     4096 Feb  9  2017 ..
drwx------  6 popuser popuser     4096 Apr 23  2018 .auto replies
-rwxr-xr-x  1 popuser popuser    18968 Jun  3  2016 cleanup-maildir
drwx------  2 popuser popuser     4096 Jul 18  2017 courierimapkeywords
-rw-r--r--  1 popuser popuser       30 Jul 14  2015 courierimapsubscribed
-rw-r--r--  1 popuser popuser  2216005 Mar  9  2016 courierimapuiddb
-rw-r--r--  1 popuser popuser   666592 Jun  5  2016 courierpop3dsizelist
drwx------  2 popuser popuser 74199040 Jan  8 18:10 cur
-rw-------  1 popuser popuser      432 Jan  8 18:10 dovecot.index
-rw-------  1 popuser popuser  5250820 Jan  8 18:20 dovecot.index.cache
-rw-------  1 popuser popuser     6196 Jan  8 18:20 dovecot.index.log
-rw-------  1 popuser popuser    33028 Jan  8 18:10 dovecot.index.log.2
-rw-------  1 popuser popuser      720 Apr 23  2018 dovecot.list.index.log
-rw-------  1 popuser popuser    12632 Jan  8 18:20 dovecot-uidlist
-rw-------  1 popuser popuser        8 Apr 23  2018 dovecot-uidvalidity
-r--r--r--  1 popuser popuser        0 Jun  6  2016 dovecot-uidvalidity.57547a5e
drwx------  5 popuser popuser     4096 Aug 11  2017 .Drafts
-rw-------  1 popuser popuser     1910 Jan  8 18:20 maildirsize
drwx------  2 popuser popuser   839680 Jan  8 18:20 new
drwx------  6 popuser popuser     4096 Aug 18  2017 .Sent
drwx------  6 popuser popuser     4096 Apr 23  2018 .Spam
-rw-r--r--  1 popuser popuser       18 Jun  5  2016 subscriptions
drwx------  2 popuser popuser     4096 Jan  8 18:20 tmp
[root@server-1012263-1 Maildir]# cd cur
[root@server-1012263-1 cur]# pwd
/var/qmail/mailnames/example.com/noreply/Maildir/cur
[root@server-1012263-1 cur]# find -type f -exec rm -f {} \;
[root@server-1012263-1 cur]# ls -al
total 72520
drwx------  2 popuser popuser 74199040 Jan  8 18:25 .
drwx------ 10 popuser popuser     4096 Jan  8 18:25 ..

Screenshot of my Plesk panel showing 15GB: https://i.imgur.com/oCToAWB.png

Doochz
  • 141
  • 3

1 Answers1

0

The ls -l doesn't show hidden files i.e. file names beginning with a dot. The long time the command takes suggests that you have plenty of hidden files in the directory. Use ls -al, instead.

   -a, --all
          do not ignore entries starting with .

   -A, --almost-all
          do not list implied . and ..

If you are absolutely sure there won't be anything important, you might empty the directory with

cd /var/qmail/mailnames/example.com/noreply/Maildir/cur
find -type f -exec rm -f {} \;
Esa Jokinen
  • 43,252
  • 2
  • 75
  • 122
  • Thanks Esa, I have pasted the output above after repeating with `ls -al` instead of `ls -l`. No hidden files were found. I have also done the `find -type f -exec rm -f {} \;` and there was no effect to the size of the 'cur' directory. – Doochz Jan 08 '19 at 10:25