Exchange 2010 database create free space (white space)

This post is also available in: Polish

 

Every mailbox database in Exchange 2010 has white space. It’s free space which can be used before .edb file will grow.

Sometimes we need to create free space in database right now if we want to avoid of growing of .edb file.

To get free space in mailbox database we can do the following:

  • move few mailboxes from mailbox database to other mailbox database
  • purge disabled mailboxes
  • purge soft-deleted mailboxes

 

Exchange 2010 check AvailableNewMailboxSpace (white space) in database:

We can check available white space for new mailboxes in mailbox databases using powershell like below:

Get-MailboxDatabase -server MBX1 | select Name, DatabaseSize, AvailableNewMailboxSpace

or if we want to check only one mailbox database:

Get-MailboxDatabase DB01 | select Name, DatabaseSize, AvailableNewMailboxSpace

 

If we want to see all disabled mailboxes (disabled today) in database we have to wait for scheduled Cleanup Agent or we can run it from powershell:

Get-MailboxDatabase -server MBX1 | Clean-MailboxDatabase

When we run above command, all mailboxes disabled today, will be marked as disabled and we can find them in Disconnected Mailboxes.

 

Exchange 2010 list disabled mailboxes:

We can get informations about disabled mailboxes to know how much space we will get when we purge disabled or soft-deleted mailboxes.

To list all disabled mailboxes in all mailbox databases in server MBX1 run:

Get-MailboxStatistics -server MBX1 | where {$_.DisconnectReason -eq "Disabled"} | select DisplayName, @{label="Mailbox Size (MB)";expression={$_.TotalItemSize.Value.ToMB()}}, DisconnectDate, DatabaseName

or if we want to check only one mailbox database:

Get-MailboxStatistics -Database DB01 | where {$_.DisconnectReason -eq "Disabled"} | select DisplayName, @{label="Mailbox Size (MB)";expression={$_.TotalItemSize.Value.ToMB()}}, DisconnectDate

If we want to know only how much space in MB deal all disabled mailboxes in database we can use belowed command:

Get-MailboxStatistics -Database DB01 | where{$_.DisconnectReason -eq "Disabled"} | %{$_.TotalItemSize.Value.ToMB()} | Measure-Object -sum

or

$(Get-MailboxStatistics -Database DB01 | where{$_.DisconnectReason -eq "Disabled"} | %{$_.TotalItemSize.Value.ToMB()} | Measure-Object -sum).sum

Exchange 2010 Soft-Deleted mailboxes:

Now we know how to get list and size of all disabled mailboxes.

Also if we move mailbox from one mailbox database to other in source mailbox database we can find hidden mailboxes with DisconnectReason status SoftDeleted.

We can get list and size of SoftDeleted mailboxes like above but we have to use:

$_.DisconnectReason -eq "SoftDeleted"

instead of Disabled.

 

Exchange 2010 removing disabled and soft-deleted mailboxes:

We know how to check database AvailableNewMailboxSpace, list disabled and soft deleted mailboxes and size, now to increase white space in mailbox database we need to remove disabled and soft deleted mailboxes from mailbox database.

To remove all disabled mailboxes from mailbox database DB01 we have to first get list of those mailboxes and then remove them:

$MBXs = Get-MailboxStatistics -Database DB01 | where {$_.DisconnectReason -eq “Disabled”}

we have list of all disabled mailboxes in database DB01 in variable $MBXs, and now we will remove all disabled mailboxes:

$MBXs | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState Disabled -Confirm:$false}

The same operation we can take with soft deleted mailboxes but we need to use SoftDeleted instead of Disabled.

 

Now we can again check mailbox database white space:

Get-MailboxDatabase DB01 | select Name, DatabaseSize, AvailableNewMailboxSpace

 

Sometimes if in mailbox database properties we checked option:

Don’t permanently delete items until the database has been backed up

disabled mailboxes will be purged after we make backup of mailbox database.
But all mailboxes disabled or moved before we make backup and if we purge those mailboxes after backup, we will get white space immediately in mailbox database.

 

Print Friendly
Tagged . Bookmark the permalink.

One Response to Exchange 2010 database create free space (white space)

  1. Javier says:

    Thanks, work perfect, ;-)

Leave a Reply to Javier Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>