User has over 60.000 mail's, can't delete anything

BlueCola

Verified User
Joined
Jan 12, 2012
Messages
73
As mentioned in a topic opened earlier today, a customer of mine had running two cronjobs every minute, sending their output to [email protected] for the past few months. Nobody noticed, until the server crashed tonight while caching the usage quota of this user's mailboxes. After some calculating, i'm sure there are over 60.000 email's in the [email protected] mailbox. When I open the map and execute the command 'ls', I can wait until I'm death as ls can only read a directory very slow. The user has 3 mailboxes:

[email protected]
[email protected]
[email protected]

It's very important that I don't delete any mail from [email protected] or [email protected]. All the mail of [email protected] could be deleted, as this are only output mails from the cron.

I have two concrete questions about this:

  • Under the user's folder I have a folder called /Maildir, which I can't open. Also there is a folder /imap/domain.com/emailbox/Maildir. Is it correct that I can delete /Maildir safely without losing any email of [email protected] and [email protected]? Will I delete only all the email of [email protected]?
  • At this moment I have 26.000 email's in my own account. In about two years this amount should be around the 50.000. It's clear for me now that DirectAdmin can't handle this amount of email's. Is their any fix or workaround to let directadmin work with this amounts of mail without crashing?

Thanks in advantage,
Marijn

Note: English is still not my native language and I know not all the spelling and grammar is correct, my apologize!
 
In my experience DirectAdmin can handle any number of emails which the underlying OS can handle; the problem is it handles it as slowly as the OS does and you may get a browser timeout.

I believe you can delete the /home/USERNAME/Maildir files without destroying any user email but I can't guarantee it because I don't know if you're doing any special routing, aliasing, or forwarding.

I wouldn't try to delete it in place, though; it could take a long time, and because of limitations of your OS it may not even be able to delete any of the messages.

Note that my recommendations below are NOT guaranteed and if I've made a mistake in this post, or depending on your system setup or settings you could lose a lot of important email. The only way to get me to guarantee the work is to pay me to have me do it for you; if you'd like to do that, then please contact me at the email address below in my siglines.

I'd find the subdirectory with the email in it; probably /home/USERNAME/Maildir/cur or /home/USERNAME/Maildir/new (possibly both).

In each of these directories delete the files one by one with the following command:

(Be sure to do this in the cur and in the new subdirectories inside the Maildir directory ONLY and nowhere else, as this is damaging behavior and if you do it in the wrong place will completely delete the contents of any directory in which you do it, and can damage your server beyond recovery)

ls | xargs rm -f

This can take up to hours to run; just leave the shell open until it's done. This is not a limitation of DirectAdmin but of your underlying OS.

Once you've cleared both directories, then delete all the /home/USERNAME/Maildir/dovecot* files so if the user ver tries to read the email for the site user the directories will be rebuilt and mail will work as it should.

Jeff
 
I didn't think about the purge function, because I've always done it from the command line. It should work. Deleting the email address probably won't work; it probably will be subject to timeout or return an error that there are too many emails to delete. Someone try it and let us know :).

Jeff
 
Back
Top