The blank space created in Exchange database when data is deleted from it is known as white space. White space causes the database to be larger b than it is.
There are two ways to deal with the white space:
- Offline defragmentation
- Deletion of the database after migrating mailboxes to a new one
Users can create a new database and move all mailboxes to that database. But this option is viable only when sufficient space is available in Exchange Server to hold a new database. Also, there is a risk of a lot of transactional logging in this case.
So, we are going to discuss a convenient way to release space from Exchange 2013, i.e., offline defragmentation of the database to shrink it.
Offline defragmentation needs Exchange 2013 database to be dismounted (mailboxes cannot be accessed during defragmentation). Let us understand prerequisites to perform the offline defrag:
- Ensure that you have a backup of the database in case of any issues
- Needs ample of space (more than 1 times the size of the database file)
- Basic knowledge of using Exchange Management Shell
STEPS TO PERFORM OFFLINE DEFRAG OF EXCHANGE 2013 DATABASE
In Exchange Management Shell, perform the following steps sequentially:
- Check the available database size in your Exchange database by executing the following command:
- Next dismount your database. Run the command Dismount-Database, provide database name as identity and then confirm by entering ‘Y.’
- Now, navigate to your database by running the command cd and providing the EDB file path.
- Run the given Eseutil /d command to defrag the dismounted database.
- Now, mount your database again with the Mount-Database command (providing database name as Identity).
Get-MailboxDatabase -Status | FT Name,DatabaseSize,AvailableNewMailboxSpace -Auto
It will display you the database size and available white space in it.
Your dismounted Exchange database is successfully defragged now.
Once your database is mounted again and has become accessible, you can again check its available size with the same command:
Get-MailboxDatabase -Status | ft name,databasesize,availablenewmailboxspace -auto
You can see that the file size has been reduced.
An alternate way to remove whitespace
As defragmentation involves downtime, Exchange experts recommend migrating the mailboxes to a new database so that the old one can be deleted. To do this, Exchange administrators need a good Exchange migration tool. Kernel Migrator for Exchange is a popular tool for migration. This tool is suitable for migrations in all versions of Exchange Server.
This blog provides the pre-requirements and steps to perform an offline defrag for Exchange 2013 database. It helps users to free the white space in the Exchange database and reduce the database size. Alternately you can migrate mailboxes to a new database and then delete the old one to remove the white space.