Skip navigation

JSI Tip 2635. How do I defragment the Active Directory database?

During the Garbage Collection process which occurs every 12 hours, online defragmentation optimizes data storage and reclaims space for new objects, but it does not reduce the size of the Active Directory database (Ntds.dit).

To defrag and compact the Active Directory database:

01. Perform a System State backup.

02. Create a folder to temporarily contain the compacted database (md "<Drive:>\Folder").

03. Restart your domain controller in Directory Service Restore mode.

04. Logon with the built in local Administrator account.

05. Open a CMD prompt and type ntdsutil.

06. Type files.

07. Type info to display the current path and size information.

08. Type compact to "<Drive:>\Folder".

09. Type quit and quit to return to the CMD prompt.

10. Copy the "<Drive:>\Folder\ntds.dit" file over the original ntds.dit as displayed in step 07.

11. Restart your DC normally.

NOTE: you may remove "<Drive:>\Folder\ntds.dit" after you restart normally.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.