Exchange Server 2007 Offline Defrag using eseutil

microsoft-exchangeWhy Offline defrag an Exchange Mailstore?

Generally speaking, you want to defragment your exchange mailstore when your exchange database (.edb) is getting too large or you are running out of disk space. Deleting mail from your mailbox does not release this space nor does online defragmentation. Online defragmentation which is scheduled automatically by the exchange server frees up space internally by removing deleted email. This space however is not restored back to your hard disk. In order to shrink your database you will need to perform an offline defragmentation.

What you need to know before you start

  • Before you start, you might want to consider asking if your users want to archive their email. Ask them to also delete unwanted email. This will allow you to release more space consumed by their emails.
  • You will need to have 110% of the space consumed by your mailstore in free space. Offline defrag uses this free space as scratch space to perform the defrag and compact operation.
  • If you don’t have enough free space in your hard disk, you can use an external USB hard disk or a network drive to store resultant database.
  • You can also run this on an external system, however you will need to copy the eseutil binaries onto that system along with the mailstore database files. The steps on how to do that can be found here.

How to defragment your mailbox database

  • First dismount your mailstore via the exchange management console.
  • Launch a command prompt and navigate to the database drive that has the free disk space (Most Exchange Mailbox Server admins store their mailstores on a separate partition to avoid running out of disk on their operating system drive).
  • Note that in the following step, if you run the defrag on your C:\ the temporary database will be stored in your C: !! If you don’t have enough free space on C:\ (where most people store their Exchange installation) your exchange server will cease to function!

  • Run
    Eseutil /d x:\<storage_group_location>\<storage_group_name>\<database_name>.edb
  • If you want to write the new database on a different location use /t option:
  • eseutil /d <database_path_and_file_name> /t <temp_database_path_and_file_name>
  • The duration of the defrag process depends on how big the database is without the bloat not how big the database currently is. Expect it to process 8-10GB/hour.
  • Once the process is done, your old database will be overwritten with the new smaller database.
  • Remember to remount your mailstore and perform a new full backup, of this new mailstore. Whatever old incremental backups you have will no longer be useful as it references the old database
Related Posts with Thumbnails

About the Author

Alfred Tong
Author and owner of this blog. A Networking enthusiast, full time networking and systems Engineer. Generally curious about all things IT.Certifications: GIAC GSEC, CCNP-S, CCNP, CCSP, CCDP, CCNA, RHCE, JNCIA - FWV