Tuesday 21 April 2015

Recovering mailbox database whitespace in Exchange 2013

Freeing up space in an Exchange database can be a daunting task - in this article I will discuss the process of cleaning up and clearing space within a mailbox database.

We should firstly take into account that when we delete mailboxes from our mailbox database they are not actually permenetly deleted - rather they are put into (by default) a "soft-deleted" state and are reffered to as "disconnected mailboxes." You should refer to this article in order to check and permenently delete any of these mailboxes.

Now even with the above performed the size of the NTFS database file does not decrease in size - this is commonly reffered to as "white space" - in order to check how much white space is contained within your database we issue the following:

Get-MailboxDatabase "Database1" -Status | select Name, AvailableNewMailboxSpace

Although this does NOT give an accurate display of whitespace and rather the eseutil utiliy must be run on an unmounted database:

eseutil /ms <database-name>

You can also refer to the event ID 1221 in the event log to find out how much white space is available.

Now we will need to perform a degramentation on the mailbox database in order to recover this space with the help of eseuil again - although the following pre-requisites must be taken into account:

- The disk space available on the mailbox database drive should be: MailboxDatabaseSize - FreeSpace * 2.
- Backup the database!

We can now start the degragmentation process by firstly dismounting the database:

Dismount-Database <database-name>

Using eseutil to perform the degramentation:

eseutil /d databasefile.edb /tD:\temp\tempdefrag.edb

Mounting the database after the operation completes:

Dismount-Database <database-name>

And finally confirming the database whitespace:

Get-MailboxDatabase -Status | ft name,databasesize,availablenewmailboxspace -auto


Post a Comment