A white space is created in a mailbox database when you create a mailbox database. This white space will be promptly reused by Exchange Server for any new content or mailboxes. However, in some situations you may have to reclaim the disk space by removing the white space. This may be due to running out of disk space or other scenarios. In this article we will see how to reclaim white space in Exchange 2010 mailbox database.
Reclaim White Space in Exchange 2010 Mailbox Database
To reclaim the white space of mailbox database, you have to defrag the database. Before you begin you must note that the defrag process will create a temporary mailbox database approximately equal to the actual size of mailbox database. This means that you must have sufficient disk space available to perform the defrag. If you have a mailbox database size of 90 GB and you have white space of 10 GB you should at least have 81 GB of free space. (1% extra on actual size of the DB to be at a safer side). To check the amount of white space a database has, type the following command in Exchange Management Shell.
Get-MailboxDatabase -Identity DB01 -Status | Select Name, DatabaseSize, AvailableNewMailboxSpace
In our scenario you can see from the below output that the mailbox database size is 90 GB and AvailableNewMailboxSpace(White Space) is 10 GB.
The defrag process copies all mailboxes to a new mailbox database and finally renames the new database as original file and leaves behind an empty mailbox database. In this process the database GUID will be changed since the file is new. You should consider this when you are working with mailbox database which is a member of DAG and has multiple copies of the mailbox on other members in the DAG. In this scenario replication will fail once you bring the database online or, the new emails might have delivered to another mailbox database which was bought online by the DAG when you dismount the active database. In order to avoid this, you can remove the the passive database copy from the DAG, dismount the database, take a backup of the active, dismounted mailbox database and then run eseutil.
Using eseutil.exe to reclaim White Space in Exchange 2010 Mailbox Database
Open Exchange Management Shell, change your directory to the location of the database file, and type the below command.
Eseutil /d db01.edb /t e:\temp\DB01_Temp.edb
I have used additional switch /t. This is to specify the location of the temporary edb file that the process creates during the dfrag. I had to do this since I did not had had enough disk space on the drive where the original mailbox database resided. You can see the below output of the command.
Once the defragmentation is complete, you can now mount the database and then check the AvailableNewMailboxSpace (White Space). Below is the output,
In this way you can reclaim white Space in Exchange 2010 mailbox database. Before the defrag white space was 10 GB, after the defrag it is now 14.1MB.