Using Disk Defragmenter to defragment Exchange 2003 database files

Posted on 2010-01-11
Medium Priority
Last Modified: 2012-05-08
Does anyone know (for sure) if it is OK to defragment an Exchange 2003 database *.EDB & *.STM files using the O/S's Disk Deframenter (DEFRAG.EXE) if:

1) I stop the Exchange Information Store service (or for that matter any other conflicting Exchange service)
2) I am not interested in reclaiming the whitespace in the DB
3) I am not worried about the DB pages being internally "optimized"

I know for sure I've upgraded disk volumes containing Exchange DBs used disk cloning tools when booted outside the O/S.  I have also copied offline DBs from one disk to another while the O/S was up (and the target DB unmounted of course) for example, after running ESEUtil /D /T /P and not instating the new/temporary/defragmented copy of the DB.  I've even been able to mount an instance of a DB that was copy/pasted to the same disk volume and then moved around.

The last two scenarios especially lead me to believe that it is possilbe to use Disk Defragmenter to defragment Exchange 2003 database files.
Question by:acisupport
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 26286686
It should work fine, but do you realize that disk defragmentation and database defragmentation are not the same thing?

What is the goal?
LVL 16

Expert Comment

ID: 26286719
Go for it. You don't need to offline the stores either. Windows can do it on the fly. As mentioned it will not defrag the database but will make the files a bit more responsive if they are heavily fragmented already. If you aren't worried about whitespace then you are fine. Once it is defragged make sure your Exchange maintenance plans are running to tidy the pages within the db or the improvement gains will only be tiny.
LVL 16

Expert Comment

ID: 26286733
FYI we have a scheduled defrag job run on our disks every weekend. I know this shortens the life of the disk a bit but it's worth the performance gains.
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.


Expert Comment

ID: 26286818

are you using the windows defrag on the disks?   and the db is up and mounted at the time?
LVL 16

Accepted Solution

btassure earned 1000 total points
ID: 26291422
Yes. If you want it to go a bit quicker you can dismount your store and stop the services but I just have a scheduled job run every week and set a 2 hour timeout on it. If it is still running then the task is cancelled. That way it still gets part of it done. It will gradually work towards complete defragmentation even if it takes a few weeks. You could set yours to run every day for the first few weeks or something...

Author Comment

ID: 26293547
The main object is to have message store files which have FAR less than the 10,000+ chunks they currently are broken up into.  You can imagine the resulting effect on performance.

Not sure I'd take the chance defragging the files without at least dismounting the DB if not stopping the I/S service.  I've been in some pretty nightmarish Exchange DB recovery situations.  My personal paranoia I guess.
LVL 16

Expert Comment

ID: 26294131
In that case I would look at dismounting the store, copy the databases to 2 separate disks then delete the original. Defrag the disks WITHOUT the db files in them. Then copy it back over from the other disk. A copy operation will defrag on the fly as long as there is enough unfragmented free space for it to use. It will save it trying to move the bytes around in the gaps of free space it has. Clear it out, consolidate the space and replace the files. Then just remount the store and start the services.

Author Comment

ID: 26294470
That's a lot to accomplish in a weekly or monthly scheduled task.  In addition, I failed to mention that I have a limited time window (6-7 hrs) to accomplish the task(s) in this particular instance.  Furthermore, by the time I do all that copying around of a 33 GB mailbox store, I might as well do it with a full ESEUtil defrag instead.  At least then I might save a little time due the reduction in size of the DB files after removing all white space.

Anyhow, given your other comments (btassure) I think my best option is to stick with my original plan.  here's the batch/script/command file I wrote to accomplish the task:

net stop SMTPSVC /y
net stop SMSMSE /y
net stop SAVFMSESpamStatsManager /y
net stop MSExchangeIS /y

C:\Windows\System32\Defrag.exe D: /v > D:\DefragLog.txt

net start MSExchangeIS /y
net start SMSMSE /y
net start SMTPSVC /y

LVL 16

Expert Comment

ID: 26294710
Good luck :)

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A list of top three free exchange EDB viewers that helps the user to extract a mailbox from an unmounted .edb file and get a clear preview of all emails & other items with just a single click on mailboxes.
New style of hardware planning for Microsoft Exchange server.
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question