Exchange 2010 Offline Defrag

we have Exchange Server 2010 at disaster recovery site which is running out of space, some of the staff who were high on the list in terms of mailbox storage has been contacted, and their mailboxe size has been reduced.

Mailbox clear out doesnt reflects the size on the Exchange Server, so we had to purge the accounts.

But it still didnt represent the free space on the physical drive, so I am planning to do an offline defragmentation?
So can you please assist me in carrying out the steps to do an offline defragmentation, and if anything goes wrong how can roll back to where i was?
Also offline defragmentation, how long it will take? and what it affect the primary site?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Why do you want to run Offline Defrag just to see how much database has shrunk?

This is what you should look at.

1. Has online maintenance been completed on the Database?
2. If it has completed then look for the Online Maintenance events in the App logs and it'll tell you how much Free space does this DB has.

If you really want to see the space reflected on NTFS then you need to run the Offline Defrag. It's a time consuming process and needs outage for many hours depending on size if database.

I don't see any implication of running Offline Defrag. Offline Defrag creates a New DB altogether and once the offline Defragmentation is completely run on the fragmented DB. It replaces the New Defragmented DB with Fragmented DB. This is what happens in the background. That's why it is recommended to have 100% of free space available to run defragmentation OR calculate the space that you need using space Dump. Specify the Temp path on the same drive for saving time on replacing the DB.

Therefore if it fails it is going to discard the New Defragmented DB and won't do anything to Production fragmented DB.

I hope it helps.

~ Singh
Miguel Angel Perez MuñozCommented:
Making offline defrag of your database, reclaims unused space as free. But during this process, users on this database can´t access to mailbox. This is procedure: and if your server runs out of space, will need to use another disk because you need as least 110% database free space on disk to do this.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rajith EnchiparambilOffice 365 & Exchange ArchitectCommented:
As you have deleted some content, the database has white space in it. You won't see any decrease in physical disk size.

The way it work is if your database is 100GB in size and you have deleted 20GB, your physical size will still be 100GB. The 20GB is called white space. But, your database won't grow until you have filled up that 20GB.

So, you will only see an increase in size, if your users fill up the database beyond 20GB.

As 2010 has online maintenance 24X7, I would say not to do any offline defrag. It is not going to do you much good, except to have a "visual" decease in physical size.
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

LeoAuthor Commented:
Thanks for all your suggestions, if i can achieve and compact the size of the physical drive then i dont have to worry about offline defrag :-)

i have just run exchange console as an administrator and when i try to see the white space, by using this command;

[PS] C:\Windows\system32>Get-MailboxDatabase General Users Storage Group 2010 -Status | FL AvailableNewMailboxSpace
A positional parameter cannot be found that accepts argument 'Users'.
    + CategoryInfo          : InvalidArgument: (:) [Get-MailboxDatabase], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Get-MailboxDatabase

I get an error?
we have five databases, so is the syntax right to check the white space?

and how i will check that online maintenance is running on all the databases?
LeoAuthor Commented:
i got the right script :-) now its running...
Get-Mailboxdatabase -Status | FL Identity, AvailableNewMailboxSpace
LeoAuthor Commented:
I am bit confused now :-) i am looking at the physical hard drives, each database is associated with a separate drive, now on primary server there is around 50 GB free on each drive but when i run
Get-Mailboxdatabase -Status | FL Identity, AvailableNewMailboxSpace

it shows that for each database there is round about 900-500 MB left and for some databases its saying there is only 130 MB left, so how does it calculate the free space? is it calculating the drive space on the DR server, which is having space issues? because it needs to replicate their.
Look at the App Logs Online Maintenance events and check if you see same amount of white space there. That will clear your confusion.

~ Singh
LeoAuthor Commented:
where i can find that information?
LeoAuthor Commented:
I found it, and i saw it has run and completed, but its showing it run for 0 seconds, requring 1 invoations over 1 it normal?
but i was not able to find event ID look at free space...
Event Viewer > Application Logs

Following article should answer all your questions

~ Singh
LeoAuthor Commented:
Just wanted to make sure that if i choose to do an offline defrag...i can stop it in the middle, if its taking too much time, and if it has created a new DataStore, it will fall off to the first one, and eveything will be as normal?
Yes. Everything will be normal even if you stop it in the middle.

To be on safe side, make a offline copy of Production DB before you start offline Defrag.

~ Singh
LeoAuthor Commented:
Now i have changed the retention policy, and asked the users to clear out their mailboxes, and i can see the white space has increased, but i dont see the same empty space on the physical drive?
This is what everyone is explaining. White space doesn't reflect in the Physical drive. Database will utilize the white space first and then start utilizing the space on physical drive. Therefore as long as you have white space in DB, your Database size on physical disk will not grow.

If you want to see the free space reflected on physical drive then you need to run the Offline Defrag.

Please go through the article that I have given above.

~ Singh
LeoAuthor Commented:
thanks, kindly let me know if i am doing this right....

i have right clicked on a database--> properties--> Limits and for keep deleted items for days, i have set it to 1.

would that mean that when people delete their emails and it goes to deleted items folder, it gets cleared out? and i can see white space on that database on the next day?

if i am wrong please direct me to the right path.....
yes, you should see the White space after 24 hours.

~ singh
LeoAuthor Commented:
Find script to run, and it worked.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.