# Reducing the size of the EDB file

I have hit an issue on a MS SBS machine where every morning the datastore for the exchange mailboxes dismounts itself.

We believe the issue is that it has grown too large over time and needs cut down a bit.

As part of this we have removed (purged) some mail files that were no longer needed, which should have given us a saving of roughly 3GB (more than enough saving for what we need).

So I deleted the mailboxes, then purged them and noticed that the .edb file was still reporting the same size, I dismounted and remounted it to see if that would have any effect but it did not.

Am I missing a step? I have read online that you can run offline defrag on the file but that seems to only save you a small amount of whitespace.

Any help would be greatly appreciated.

-

## 3 Answers

Whilst your Exchange database will automatically increase in size when needed, it will not shrink in size automatically. So the 3GB of space you have freed up is there, but it is still allocated to Exchange, and as the mailbox store size increases again, it will use up this space first. So for the next 3GB of mailbox store increase you should not see an actual increase in size of the file on disk.

If you actually need to get the space back on disk, then you will need to do an offline defrag.

Also make sure you have done a full backup recently to ensure all the log files have been cleaned up.

-
Thank you, literally just found an article explaining that somewhere else but you have explained it concisely and well. –  Toby Mar 7 '11 at 15:27

Exchange will never automatically release freed space in database files, but it will reuse it for new data. There are two ways to actually reclaim free space: perform an offline defrag of the database file, or move the mailboxes to another store and delete the old one.

With the first method, you need to dismount the store and defragment it using the Exchange utility eseutil.exe (found in the \bin directory under the Exchange installation folder); the syntax would be eseutil.exe /D path\to\file.edb. This will take a while: actual time depends on the database size and disk speed, but it is definitely not a fast process; could easily be hours for big stores; it will also need as much temporary free space as 110% of the database size. During the process, all the mailboxes in the store will not be available to users.

With the second method, you create a new empty store and move mailboxes to it, then you delete the old store when it's empty. The stores are both online at the same time, and service disruption only impacts those users whose mailbox is actually being moved (usually at most 4 at the same time); other users in the same store are unaffected. The end result in terms of freed space is the same, but the process is much easier and almost completely avoids downtime. This is what Microsoft recommends if you really need to recover disk space in an Exchange database.

-

3rd-party archiver probably wouldn't go amiss.

Exclaimer are good but I don't know if they work with anything older than 2007. Google around, they're not the only provider.

Anyway, extract it all and set a retention policy tag with a retention period of, say, 40 days. Exchange only keeps emails for 40 days, the archive can hold all the rest.

Good luck!

-
Hi and Welcome to Serverfault! Please read the How to Answer a Question Guide. This site is a Q&A site not a forum. –  slm Apr 10 '13 at 14:39