Fixing Large Kerio Mailboxes

I bet you have customers who never delete anything out of their Inbox, or if they do, they never empty their deleted items folder. If they are using Outlook PST files, they will sooner or later reach the maximum file size possible and their mail will break (actually, with Outlook it will usually break before that). Sometimes you can fix it with SCANPST.EXE, sometimes you can't.

If you are using Imap or Kerio Outlook connector, you won't see quite the same problem. Kerio stores mail messages individually on the server, so you are never in danger of reaching file size limits - well, technically you still could because the directory itself could grow too large, but that would take an unimaginable number of messages.

Even so, having a lot of messages is a problem. It slows things down: if you have 40,000 messages in your INBOX, think about what happens at the system level when a new message arrives. That directory with 40K items already in it has to be scanned to find a free spot to stick the new entry. It takes time to scan a big directory; if you have dozens of users all with giant INBOX files, the arrival of new email can really slow the system down. That's just the OS: Kerio itself maintains indexes of the messages, and every new message requires adding to that ever growing index.

Note that there's nothing wrong with having large mail folders. It's having large mail folders that need to be accessed frequently (INBOX, Junk Mail, Deleted Items) that is the problem.

So what's the solution? Well, you could just drag and drop a bunch of messages into a new folder, and if you had been doing that regularly before you got up to tens of thousands of messages, that's fine. But once you get a very large directory, it stays large even when it becomes mostly empty - it still takes extra time to scan through it. So what to do?

With Kerio, the solution is pretty simple. Stop the mailserver. That's usually done with the Kerio Engine Monitor, though on Linux you can do it with "/etc/init.d/keriomailserver stop". Now rename the oversized directories for each user to something else. You might rename their INBOX as "Inbox201412", for example. Do the same for large Deleted Items and Junk mail folders. Restart the server; new mail will cause Kerio to automatically create any folders it needs (INBOX, etc.), but they will now be small and quickly scanned.

It's that easy, and it can really improve performance.

As with anything like this, be sure to have adequate backups before implementing this procedure.

See also Kerio mailbox archiving.

Got something to add? Send me email.

(OLDER) <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Fixing large mailboxes in Kerio Mail Server


Increase ad revenue 50-250% with Ezoic

More Articles by

Find me on Google+

© Anthony Lawrence

Tue May 27 16:23:46 2008: 4245   cenoxo

We have an executive user whose Outlook 2003 KOC mailbox is very slow (even when accessed from a fresh Outlook/KOC setup on another PC). This user insists upon 'filing' old messages in their Deleted Items folder, and it contains several thousand messages that they may open at any time.

If, as you suggest, we just rename their current Deleted Items folder as "Deleted Items200805" (and Kerio Mail Server creates a new, fresh "Deleted Items" folder for them), won't they just encounter the same slowdown whenever they access their old "Deleted Items200805" folder?

Tue May 27 16:26:04 2008: 4246   TonyLawrence

Yes, of course, but that folder won't be accessed every time they delete new messages. If you can keep doing this regularly, it should help.

Tue May 27 17:31:05 2008: 4247   cenoxo

We're using Kerio Mail Server 6.3.1 (patch 2 build 3474) with Kerio Outlook Connector 6.3.3474. I know these are older versions, but upgrading KMS is not currently an option.

Is there a general rule of thumb regarding the maximum number of messages a user should keep in their Inbox, Deleted Items, etc. folders? 500? 1000?

Would recreating the user's index.fld files in each of their mail folders -- by renaming index.fld to index.bad and letting Kerio rebuild them when the user reopens Outlook 2003 -- help speed things up?

Tue May 27 22:01:47 2008: 4249   TonyLawrence

I don't know why "upgrading is not an option" - that makes zero sense. Kerio upgrades are free if you are paying for support - and support is inexpensive.

I doubt rebuilding the index will help. A "too large" directory depends on the OS, filesystem and tuning parameters, but anything over a few thousand is getting toward it.

Tue May 27 22:46:29 2008: 4250   cenoxo

Well, not doing a KMS upgrade at this time makes plenty of sense from a tech support pov since it will affect all of our users in one way or another. Right now, the current problem under discussion needs to be solved asap for just one VIP user.

Although his Deleted Items folder contains several 1000 items, wouldn't Outlook/KOC _not_ slow down until his DI folder is opened? His InBox -- which contains less than 200 items -- is lethargic while scrolling, opening attachments, moving messages into other folders, etc.

Thanks for the help!

Wed May 28 09:34:40 2008: 4251   TonyLawrence

That's correct, yes.

But you are being very short-sighted on the updates.

Wed Jul 9 17:55:07 2008: 4405   cenoxo

>> are being very short-sighted...

T'won't be the first time -- I'm just playing the cards I've been dealt right now.

More questions --

>>Kerio itself maintains indexes of the messages, and every new message requires adding to that ever growing index.

So even if a user has pared their Inbox and Sent Items folders down to a few hundred messages, they could still experience slowdowns if their "Deleted Items" folder has a couple 1000 messages (because its index is hit every time they delete a message).

When you rename Kerio mail folders such as "Deleted Items", this should be done on the mail server in the user's Kerio mail store folders, correct? If I rename a user's existing "Deleted Items" folder to "Deleted Items 07092008", then Kerio recreates a new, empty "Deleted Items" folder the next time the user opens Outlook. Will they also see the renamed "Deleted Items 07092008" folder?

Why not do all this directly within Outlook? Couldn't you just move all of the files in the user's existing "Deleted Items" folder into a new "Deleted Items 07092008" folder?


Wed Jul 9 18:22:47 2008: 4406   TonyLawrence

Yes, I did mention Deleted Items.

The users can copy messages to a new folder, but that won't decrease the the number of directory slots.

Sun Feb 8 11:56:19 2009: 5343   JoseKucher

Great Tony, your article solves my kerio problem

Sun Feb 8 11:57:25 2009: 5344   TonyLawrence

Glad to have helped!

Tue Mar 31 10:44:13 2009: 5922   stevan


I did what you suggested and it worked fine, thank you.
Since I moved Sent Items to an Archive folder though, it created a new Sent Items in the users root directory, but still stores new Sent Items in the User/Archive/Sent Items by default.
Why is that and is there any way to change it?
Thank you very much for your help.

Tue Mar 31 16:05:22 2009: 5925   TonyLawrence

Did you restart the server

Tue Mar 31 16:20:54 2009: 5927   stevan

yes, made the changes at stopped KMS, then restarted the whole server and restarted KMS.
Inbox & Deleted Items (which I also changed) work fine in the automatically created new folders, just Sent Items doesnt. ?

Tue Mar 31 16:23:23 2009: 5928   TonyLawrence

Well, either it's accessing through a link (double check that) or it has cached the inode somewhere - I'm just guessing at this. Try renaming "index.fld" to "index.bad" in both folders and restarting.

Mon Oct 12 23:49:00 2009: 7211   NickBarron

I came to this article through a link from a current article. I think I remember reading this when it was first published.. ( I am feeling old at the moment...)

Is there a specific reason I always seem to see the recommendation for renaming the index.fld file to index.bad. Can it be renamed badindex.fld etc or does Kerio look for .bad ext's specifically.

just one of those random questions...

Tue Oct 13 00:02:45 2009: 7213   TonyLawrence

I don't know.

Try it - if it recreates the index, then no, it doesn't matter.

Tue Oct 13 00:10:56 2009: 7214   NickBarron

It seems funny that, it is one of those things that has just spread around the Kerio support forums.

If you rename the index file to badindex.fld it does indeed rebuild it during my tests.

Tue Nov 29 18:40:29 2011: 10269   anonymous


Ho do I find/examine the message store and determine who has large inbox/deleted/sent folders?

Tue Nov 29 19:36:04 2011: 10270   TonyLawrence


You set the location of the Store in your Configuration.

After that it's mail/domain/username/

Kerio Connect Mailserver

Kerio Samepage

Kerio Control Firewall

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Principles have no real force except when one is well-fed. (Mark Twain)

[C has] the power of assembly language and the convenience of … assembly language. (Dennis Ritchie)

This post tagged: