« Friday’s Tech News Grab Bag | Home | Monday Morning Linkblast »
How To: Defrag an Exchange Database and/or Move it to a New Harddrive
By TheEmperor | February 16, 2008
Many a time I have heard the wailing and gnashing of teeth when an Admin finds that it is time to move the exchange database to a new hard drive. This process can take an eternity when the database is very large. Our database is 75gb and it has come time to move it to a new and faster hard drive to quiet the troublesome users and their incessant complaining. And lo from the techs there came a mighty gnashing of teeth and cries of, “We’ll be here all weekend!” and “The mail server will still be down on monday!”. But I quieted their fears as I shall quiet yours for there is a better way. The normal process of moving an exchange database to a new hard drive is as follows:
- Open your Exchange System Manager Console
- Expand the tree until you see the First Storage Group
- Right Click on the Mailbox store whose Database you wish to move and click Properties
- Click on the Database tab
- Click Browse
- Select the new location for the Database
- WAIT FOR HALF AN ETERNITY FOR THE GIANT DATABASE TO BE MOVED.
It’s also a good idea to update your registry entry here HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ MSExchangeIS\ParametersSystem\WorkingDirectory to point to the new path.
Now, I for one hate step 7. It’s a pain. So I’ve got a great solution for you. We’re going to Defrag the database AND move it. Now I know what you’re thinking, Defragging it takes forever too. Won’t that just double the amount of time we’re working? Not so my friend, not so.
With our handy ESEUTIL we will simultaneously defrag AND move the database. The normal ESEUTIL /D is the command to run an offline defrag of your database.
You unmount the Database and then run the command. Well with a second flag /P you can tell ESEUTIL to create a second copy of the database. So now our line will look like this ESEUTIL /D /P “x:\path\to\your\database.edb ” /t”y:\new\path\to\database.edb”. It is important to note that there IS NOT a space between the /t and the “. What this does is defrag the database and put a new, defragged copy of that database in the directory specified after the /t. Now just point exchange at the new database using the procedure I outlined above and enjoy.
The ESEUTIL /D /P should take quite a bit less time that trying to move the database normally and as a bonus you get a defragmented database. Huzzah! If I’ve just saved you a saturday please feel free to





