How to Remove White Spaces in Exchange Database?

Avatar Ruchika Srichand Updated On - 16 Dec 2019

When you add data to an Exchange database, naturally the size of the database will increase; but if you delete some mailboxes, the size of Exchange database may not necessarily decrease – it may remain same. For example, if your database size is 30 GB, and you delete 4 GB data, then the expected the size of the database would be 26GB. But you will notice that the size remains same, and it is 30 GB. However, space available to add new data will be 4 GB. This ‘Available new mailbox size’ is commonly known as Whitespace.

More about Whitespace

Whitespace is the area in Exchange database which is created by the deletion of an item or object (like a mailbox). The whitespace is reused by the Exchange database to store new items and objects. However, it will not be visible as said above. But, you can reclaim this space manually by removing the white space.

How to find White Space?

There are three ways to find the white spaces available in your Exchange Database. You can use the below commands to find white space.

  1. To check white spaces on a mailbox database, use:
  2. Get-MailboxDatabase < DB Name > -status | Select-Object Server,Name,AvailableNewMailboxSpace
  3. To check white spaces on all mailbox database on a server, use:
  4. Get-MailboxDatabase –Status –Server < servername > | Select-Object Server,Name,AvailableNewMailboxSpace
  5. To check white spaces on all mailbox database on all server, use:.
  6. Get-MailboxDatabase -status | Select-Object Server,Name,AvailableNewMailboxSpace

The manual approach to remove white spaces

You can remove white space from your Exchange database by Defragmentation. This defragmentation process is of two types- one is online and the other is offline.

  • Online defragmentation
  • Online database defragmentation process is entirely automatic. You do not need to initiate it; Exchange will automatically run it every night. However, online defragmentation does not reduce the size of the database – it remains same. It removes the expired messages. It also cleans up deleted mailboxes on mailbox store. To reduce the size of the database, you should go for Offline defragmentation.

  • Offline defragmentation
  • Offline database defragmentation helps to reduce the size of Exchange database. With the use of this process, you can compact the size of the database by eliminating the unused storage space. This process creates a new database having no empty pages (it replaces the older ones with the new ones or deletes the older ones). You can perform defragmentation by Eseutil facility. This process improves the efficiency of Exchange database. But you can do this only when you have large amount of free space.

Here is the process by which you can defrag your Exchange database:

  1. Before starting defrags process, you should ensure that how much amount of white space is available in Exchange database with the below command in Exchange Management Shell.
  2. Get-MailboxDatabase < Database name > -Status | Format-List Name, DatabaseSize, AvailableNewMailboxSpace
  3. Now after checking you have to dismount your Exchange database.
  4. Dismount-Database < database name >
  5. Once you have dismounted Exchange database, defragment the databae
  6. Eseutil /d < database_name >
  7. Now run the defrag the dismounted database and mount the database again.
  8. Mount-Database < database name >
  9. After all the steps check the white space available in your database after defragmentation.
  10. Get-MailboxDatabase < Database name > -Status | Format-List Name, DatabaseSize, AvailableNewMailboxSpace

Some other Exchange issues

Apart from its large size, Exchange Database can be affected by many other issues including DDB file corruption. A corrupt EDB file becomes inaccessible to its users. So, the EDB files needs to be repaired at the earliest. But you can try third-party Exchange recovery tools to fix such issues. Kernel for Exchange Server Recovery is an efficient tool in fixing all Exchange related issues including corruption.