Checking and reclaiming whitespace on a Exchange server

Over time your Exchange databases might get polluted with data that has been deleted.
When you delete data from a Exchange database it doesn’t get fully deleted but instead, the data will be overwritten with zero’s.

If you have large databases with a lot of data that get removed then looking at the amount of “whitespace” there is available in the database might allow some space reclemation.

The command to check the amount of whitespace is very easy, just run this PowerShell line from the Exchange Management Shell:

Get-MailboxDatabase -Status | sort name | select name,@{Name='DB Size (Gb)';Expression={$_.Data
baseSize.ToGb()}},@{Name='Available New Mbx Space (GB)';Expression={$_.AvailableNewMailboxSpace.ToGb()}},EdbFilePath

The result is a overview of the amount of disk space per database and the amount of data which contains zero’s in the database:

All the information you need 😉

As you can see there is a fair amount of disk space that we can reclaim from the databases.
This can be done by dismounting the database and defragmenting it with ESEUTIL.
Bear in mind that defragmentation requires 110% database size so a database of 100GB will require 10GB extra space on your hard drive during the defragmentation process.

Let’s capture the database you want to defrag in a variable:

$db=Get-MailboxDatabase -identity "NAME property of database you want to defragment"

Now let’s dismount the database, please note that dismounting means downtime as it will be placed offline.

Get-MailboxDatabase -identity $db | Dismount-Database

Still in the Exchange Management Shell browse to the path where ESEUTIL resides:

cd $env:ExchangeInstallPath\Bin

Then make sure the database has been dismounted and is in a “Clean Shutdown” state:

eseutil.exe /mh $db.EdbFilePath

After you’ve validated that the database has been dismounted properly you can start the defragmentation process:

eseutil.exe /d $db.EdbFilePath

After you’ve completed the defragmentation mount your database so it will be operational again and the mailboxes will be accessible.

Get-MailboxDatabase -identity $db | Mount-Database

This concludes yet another blog.

If you have any questions, go ahead and post in the comments section below!

Dit vind je misschien ook leuk...

Geef een reactie

%d bloggers liken dit: