- 24x7 Background Database Maintenance (BDM) is default: Modern Exchange Server SE and 2019 run online defragmentation (`OLD2`) and background database scanning continuously at low I/O priority rather than only during a 1:00 AM–5:00 AM maintenance window.
- Online defrag creates internal "White Space" (`AvailableNewMailboxSpace`), NOT OS disk space: Online compaction frees pages *inside* the `.edb` file so the database stops growing, but it never shrinks the physical `.edb` file on disk.
- Never run offline `eseutil /d` in a DAG: To reclaim physical disk space on a bloated `.edb` file, create a new mailbox database, move mailboxes online with `New-MoveRequest`, and delete the old database.
In early Exchange releases, database maintenance ran as a rigid overnight batch job (MaintenanceSchedule) between 1:00 AM and 5:00 AM. As mailbox sizes grew into tens of gigabytes and multi-terabyte databases became standard, a 4-hour overnight window was no longer sufficient to scan and compact an entire Extensible Storage Engine (ESE) .edb file.
In Exchange Server Subscription Edition (SE) and Exchange Server 2019, the Managed Store (Microsoft.Exchange.Store.Worker.exe) performs 24x7 Background Database Maintenance (BDM)—continuously compacting B-tree pages, verifying page checksums, and automatically patching single-bit corrupt pages from healthy DAG passive copies without downtime.
This runbook explains the 5 core ESE maintenance operations, how to audit database white space (AvailableNewMailboxSpace) via PowerShell, and the safe way to reclaim physical disk space without taking databases offline.
1. The 5 Core ESE Database Maintenance Tasks Explained
- Mailbox & Item Retention Cleanup (
DumpsterPurge): Purges items from theRecoverable Itemsfolder that have exceededDeletedItemRetention(default 14 days) and disconnected mailboxes that have exceededMailboxRetention(default 30 days). - Online Database Compaction & Defragmentation (
OLD2): Consolidates records scattered across partially empty 32KB ESE B-tree pages onto fewer pages, marking the freed pages as reusable internal White Space (AvailableNewMailboxSpace) and keeping table sequentiality high. - Background Database Checksumming (Online Database Scanning): Reads the
.edbfile in sequential chunks to verify every page's cryptographic checksum and header timestamp—catching silent storage corruption ("bit rot") or lost write flushes on cold pages rarely accessed by users. - Automated Single-Page Patching: In a Database Availability Group (DAG), if the Managed Store or background scanner detects a corrupt page (or single-bit flip, ESE Event ID
474/1018), the Exchange Replication Service (MSExchangeRepl.exe) automatically fetches the healthy page from a passive DAG copy, patches the active database in-flight, and logs Event ID486—with zero interruption to users. - Database Page Zeroing: Overwrites deleted database pages with binary zeros so sensitive data cannot be forensically CARVED from raw unallocated
.edbblocks.
2. Auditing Database Size, White Space & BDM Status via PowerShell
Run this script in the Exchange Management Shell (EMS) to calculate each database's total size, free internal white space (AvailableNewMailboxSpace), and the percentage of reclaimable disk space:
Get-MailboxDatabase -Status | ForEach-Object {
$sizeGB = [math]::Round($_.DatabaseSize.ToBytes() / 1GB, 2)
$whiteGB = [math]::Round($_.AvailableNewMailboxSpace.ToBytes() / 1GB, 2)
$pctFree = if ($sizeGB -gt 0) { [math]::Round(($whiteGB / $sizeGB) * 100, 1) } else { 0 }
[PSCustomObject]@{
DatabaseName = $_.Name
MountedOnServer = $_.Server.Name
Mounted = $_.Mounted
TotalSizeGB = $sizeGB
WhiteSpaceGB = $whiteGB
WhiteSpacePercent = "$pctFree %"
24x7BDMEnabled = $_.BackgroundDatabaseMaintenance
LastFullBackup = $_.LastFullBackup
}
} | Sort-Object WhiteSpaceGB -Descending | Format-Table -AutoSize
3. How to Reclaim Physical Disk Space (Why You Should Never Run eseutil /d in Production)
Because online defragmentation (OLD2) only marks pages free inside the .edb file, a 1.2 TB .edb file with 500 GB of AvailableNewMailboxSpace still consumes 1.2 TB on your NTFS or ReFS volume.
Historically, administrators dismounted the database and ran eseutil /d (offline defragmentation). In Exchange Server SE and 2019, running eseutil /d on a production database is an anti-pattern:
- It requires hours of complete mailbox downtime while the database is dismounted.
- It rewrites the
.edbfile with a brand-new database signature, breaking all DAG passive copies and forcing a full multi-terabyte reseed (Update-MailboxDatabaseCopy).
The Zero-Downtime Online Space Reclamation Procedure
# 1. Create a fresh replacement database on your ReFS/NTFS volume
New-MailboxDatabase -Name "MDB02-Clean" `
-Server "EXCH-SE-01" `
-EdbFilePath "E:\Databases\MDB02-Clean\MDB02-Clean.edb" `
-LogFolderPath "L:\Logs\MDB02-Clean"
Mount-Database "MDB02-Clean"
# 2. Add DAG passive copies for the new database
Add-MailboxDatabaseCopy -Identity "MDB02-Clean" -MailboxServer "EXCH-SE-02" -ActivationPreference 2
# 3. Move all user, shared, and arbitration mailboxes online (Zero downtime!)
Get-Mailbox -Database "MDB01-Bloated" -ResultSize Unlimited |
New-MoveRequest -TargetDatabase "MDB02-Clean" -BatchName "Reclaim-MDB01"
Get-Mailbox -Database "MDB01-Bloated" -Arbitration |
New-MoveRequest -TargetDatabase "MDB02-Clean" -BatchName "Reclaim-MDB01-Arb"
# 4. Once all moves reach 'Completed', remove passive copies and delete the old bloated database
Get-MoveRequest -BatchName "Reclaim-MDB01*" | Where-Object { $_.Status -eq "Completed" } | Remove-MoveRequest -Confirm:$false
Remove-MailboxDatabaseCopy -Identity "MDB01-Bloated\EXCH-SE-02" -Confirm:$false
Remove-MailboxDatabase -Identity "MDB01-Bloated" -Confirm:$false
After removing MDB01-Bloated, delete the old .edb and log files from disk to immediately reclaim the 500+ GB of physical storage.
đź’¬ Reader Comments & Feedback
Did this runbook help, or did Microsoft change a cmdlet or UI menu? Share your feedback below.
Leave a Comment or Report an Update