You have an Exchange Hybrid configuration and want to migrate a mailbox from Exchange Online…
Clear white space in Exchange database
It’s good to know how to check and clear white space in Exchange database. What’s more important is to clean white space in Exchange database, the recommend and safest way. It will take four steps to remove white space in Exchange database. In this article, you will learn how to reclaim white space in Exchange Server.
Table of contents
Information
To clear white space, we recommend you to follow these steps:
- Check white space Exchange database
- Create a new mailbox database
- Move all mailboxes from one database to another
- Delete old mailbox database
Check white space Exchange database
Read more in the article Get mailbox database size and whitespace.
Run Exchange Management Shell as administrator. Use the Get-MailboxDatabase cmdlet, including the AvailableNewMailboxSpace parameter, to get the available new mailbox space.
In our example, database DB01 got 107.9 GB available new mailbox space.
[PS] C:\>Get-MailboxDatabase -Status | Select Name, DatabaseSize, AvailableNewMailboxSpace | Sort-Object -Descending AvailableNewMailboxSpace
Name DatabaseSize AvailableNewMailboxSpace
---- ------------ ------------------------
DB01 499.6 GB (536,468,258,816 bytes) 107.9 GB (115,884,228,608 bytes)
We want to clear white space in Exchange database DB01.
Create a new mailbox database
Read more in the article Create mailbox database in Exchange Server.
Sign in to Exchange Admin Center (EAC). Click servers in the feature pane and click databases in the tabs. Create a new mailbox database. In our example, it’s mailbox database DB02.
Move all mailboxes from one database to another
Read more in the article Move all mailboxes from one database to another.
Get all mailboxes from source database DB01 and move them to target database DB02.
[PS] C:\>Get-Mailbox -Database "DB01" -ResultSize Unlimited | New-MoveRequest -TargetDatabase "DB02"
DisplayName StatusDetail TotalMailboxSize TotalArchiveSize PercentComplete
----------- ------------ ---------------- ---------------- ---------------
Administrator WaitingForJobPickup 694.2 KB (710,903 bytes) 0
Christopher Payne WaitingForJobPickup 805.7 KB (825,070 bytes) 0
Mary Walsh WaitingForJobPickup 53.4 KB (54,682 bytes) 0
Benetiz Anees WaitingForJobPickup 411.4 KB (421,233 bytes) 0
Larson Tevin WaitingForJobPickup 40.93 KB (41,913 bytes) 0
Jake Cornish WaitingForJobPickup 40.93 KB (41,913 bytes) 0
Delete old mailbox database
Read more in the article Delete mailbox database in Exchange Server.
In Exchange Admin Center, go to servers in the feature pane and click databases in the tabs. Select the database that does not have any mailboxes on. Unmount and delete the database.
We did successfully reclaim white space in Exchange database. Did this help you to remove white space in Exchange database?
Keep reading: Cleanup logs Exchange 2013/2016/2019 »
Conclusion
In this article, you learned how to clear white space in Exchange database. Follow the steps closely as it’s the only correct way to reclaim white space in Exchange Server. After that, you will have a new mailbox database with all the mailboxes.
Did you enjoy this article? You may also like Get disk free space with PowerShell. Don’t forget to follow us and share this article.
Hi Ali,
Environment: Hybrid setup with 2x on-premises Exchange 2016 servers in DAG setup.
Scenario: Both local Exchange servers (MAILSVR1 & MAILSVR2) drives containing the DB are running low on free disk space.
Proposed Solution: I plan to create a new partition (same drive letter) on both mail servers. Next create a new Database and move the mailboxes from old DB to new DB. Then delete old DB.
My question is:
If I move the mailboxes on MAILSVR1 from old DB to new DB, will it auto-sync with the new same partition on MAILSVR2?
Do I need to any changes in the DAG as well?
Please confirm or advise best solution.
Many thanks
Ken
Hi Ken,
How do you create a new partition with the same drive letter? That’s not possible.
I recommend you to go through the steps below:
1. Create a new partition with a new drive letter on EX01.
2. Create an identical partition and drive letter on EX02.
3. Create the mailbox database on EX01.
4. Configure mailbox database copies.
5. Migrate the mailboxes to the new mailbox database.
Suppose the mailbox database is growing, there is no white space to clear, and the disk is getting low on disk space. So you have to move the mailbox database.
Follow these steps:
1. Remove all mailbox database copies for the database being moved.
2. Move the mailbox database path to the new location.
3. Create the necessary folder structure on each Mailbox server that previously contained a passive copy of the moved mailbox database.
4. Move the passive copy of the mailbox database and its log stream to the new location.
5. Add all of the database copies that were removed.
6. On each server that contains a copy of the mailbox database being moved, run the cmdlet Restart-Service MSExchangeFastSearch.
You can read more over here: Move Exchange DAG database to another drive.
Hi Ali,
Thank you for your quick response.
Regards
Great article! What about space considerations? For example when moving a 1GB mailbox from mailbox database DB01 to DB02, does the mailbox ever take up more than 1GB of space on the Exchange server during the move?
In my scenario, DB01 and DB02 exist on the same Exchange 2019 server. Thanks!
Migrations generate a lot of transaction logging on the destination mailbox database.
As a general rule, you can estimate that 1GB of transaction logs will be generated per 1GB mailbox data that is being moved.
So you need to be careful not to oversize your migration batches. Don’t try to move more gigabytes of mailbox data than you have available in transaction logs space on your destination server. In your case, it’s the same server.
Read more: Mailbox migration best practices.
Hi…I was using your commands to move the mailboxes to a new database. During the night, there was a power outage and now one mailbox has a status of StalledDueToTarget_DiskLatency.
How do I deal with this? Can I get it to resume somehow?
Thanks,
Jim
Hi Jim,
Delete the move request and start a new move request for that mailbox.
Ali
What about offline DB defrag using eseutil.exe /d ?
Shrinking mailbox databases with ESEUTIL is not recommended.