How to Get Mailbox Database Size and White Space?
Microsoft Exchange Server can hold very large databases. In fact, the maximum size of database that Exchange Server can withstand is 1TB. This is the default size limit as the maximum supported limit is 16TB. However, it is recommended not to go over the 2TB size, when having databases in a Database Availability Group (DAG). In the Exchange Server Standard Edition, there is a limit of five mailbox databases. If these databases are getting huge, it is recommended to split the load across multiple databases. If you need to split your mailboxes over more than five mailbox databases, then you need to consider going for the Exchange Server Enterprise Edition.
Large mailbox database doesn’t mean that you have a lot of data. In this article, we are going to explore what is white space and how to clean it up.
What is White Space?
A mailbox database, like any other database, grows automatically when there is a need. Suppose, if the database is using 450MB from the allocated 500MB and you want to store more data in it which exceeds 50MB, the database size allocation will automatically expand, for example, with batches of 100MB. In this case, the database will increase to 600MB with 100MB to spare. This is called white space. White space is just an empty space in an allocation.
White space can also be when you have a database which is showing 600MB on disk and holding 400MB in space. This could be because the database has at a point increased to 600MB but some data has been deleted and the empty space has not been claimed back to the operating system.
Not maintaining your Exchange Server database could result in issues. You would end up with no disk space which could lead to the service being interrupted and even data becoming corrupted. White space needs to be dealt with and needs to be kept under control.
In the example below (see the image), white space is just empty space in the mailbox database drive, which is being consumed with nothing.

In this example, if you view this drive from the Computer Management or File Explorer, you will see that the drive has 85GB used and 15GB free space. You will not be able to see the white space.
How much White Space do I have?
You need to check from within the Exchange Server to see if the databases have any white space in them. You need to clear it out to reclaim the space in your mailbox database drive. This can be done by using PowerShell commands in the Exchange Management Shell. You can use the Get-MailboxDatabase cmdlet.
Get-MailboxDatabase -Status | Select Name, DatabaseSize, AvailableNewMailboxSpace
This will give information, such as the name of the database, database size, and the amount of white space in the database. If you would like to sort by the database which has the maximum white space, you need to modify the command (as given below).
Get-MailboxDatabase -Status | Select Name, DatabaseSize, AvailableNewMailboxSpace | Sort-Object -Descending AvailableNewMailboxSpace
If you would like to view the space in GB, you can use the Expression parameter in the command.
Get-MailboxDatabase -Status | Sort-Object -Descending AvailableNewMailboxSpace | Select Name,@{Name=’DatabaseSize (GB)’;Expression={$_.DatabaseSize.ToGb()}},@{Name=’AvailableNewMailboxSpace (GB)’;Expression={$_.AvailableNewMailboxSpace.ToGb()}}
At this stage, you have a clear overview of the databases which would need to be cleared from the extra space and have the storage reclaimed for the operating system.
Clearing the White Space
There are two methods to remove white space from a mailbox database.
1. You can create a new mailbox database and move all the mailboxes to this new database. Once all the mailboxes have been moved, you can delete the old mailbox database. This will take a considerate amount of time. This method is not recommended, especially if you’ve already reached your number of databases limit.
2. You can use PowerShell to shrink your database by eliminating the white space found in the mailbox database. First, you need to unmount the database. This can be done via the Exchange Admin Center or the Exchange Management Shell.
To do it from the Exchange Management Shell, you need to run the following command.
Dismount -Database <database name>

Once dismounted, you need to use ESEUtil to defragment the database to remove the extra space. Execute the below command:
Eseutil /d <database name> /t <temporary database name>

After the operation is complete, you can re-run the command to see the space.
Things to notice when using the ESEUtil to remove the white spaces
- You will need extra space to do the operation as it creates a temporary database. If your server is already short on storage, this is going to be a problem.
- During this operation, you need to dismount the database. This means new emails will not be delivered and access to the mailbox will not be possible.
What to do if Database gets corrupt?
You can use Stellar Repair for Exchange in case the database gets corrupt due to lack of disk space. With Stellar Repair for Exchange, you will be able to open corrupt Exchange Server mailbox database of any Exchange Server version. You can open and browse through databases and export the mailboxes to PST and other formats. Using this software, you can export mailboxes directly from EDB file to a live Exchange Database or Office 365 tenant.