Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

Using Disk Defragmenter to defragment Exchange 2003 database files

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.
1 Solution
It should work fine, but do you realize that disk defragmentation and database defragmentation are not the same thing?

What is the goal?
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.
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.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


are you using the windows defrag on the disks?   and the db is up and mounted at the time?
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...
acisupportAuthor Commented:
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.
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.
acisupportAuthor Commented:
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

Good luck :)

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now