NTDSUTIL to run Offline Defragmentation in Windows 2003,2000 Active Directory

If you're new here, you may want to subscribe to Windows Reference RSS feed Thanks for visiting!

By default Windows runs an online Defragmentation of the Windows Active Directory database every 12 hours. However, Online defragmentation doesn’t recover the disk space or compact the database. It simply moves data around.

An Offline Defragmentation, on the other hand performs a defragmentation on the database, compacts it and recovers the space. Use the “ntdsutil” utility to run Offline Degramentation on Windows Active Directory. This requires unmounting the Active Directory which mean rebooting the server in “Directory Service Restore mode”.

NOTE: It is important that you take a backup of the Active Directory before performing this operation.

1. Reboot the Windows Server.

2. Press F8 to bring up the Windows Startup menu.

3. Select the ” Directory Services Restore Mode”. This will start Windows Server in Safe Mode and the Directory Service not running

4. Login as a local admin.

5. Now, from the command prompt (Start – Run – type “cmd” and press enter)

6. Run the command ntdsutil.exe

C:\> ntdsutil

This will launch the ntdsutil

7. Enter “files” at the ntdsutil prompt.

This will launch the file maintenance mode

8. Enter “compact to c:\tmp\”

This will instruct ntdsutil to compact the database to c:\tmp\ folder. This could be any folder. Basically, “ntdsutil” will compact and create a new database leaving the original database file ntds.dit in “%systemroot\ntds\” folder.

9. Replace the original ntds.dit file with the new compacted one.

c:\tmp> copy ntds.dit %systemroot%\ntds\ntds.dit

That completes the process. Reboot the server as normal and check if all is OK. Should there be a problem, be prepared to restore your backup ;-)

  • Share/Bookmark

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically each day to your feed reader.

No comments yet.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

(required)

(required)