Any suggestions? Export (0) Print
Expand All

Returning Unused Disk Space from the Active Directory Database to the File System

Updated: June 8, 2005

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

During ordinary operation, the white space in the Active Directory database file becomes fragmented. Each time garbage collection runs (every 12 hours, by default), white space is automatically defragmented online to optimize its use within the database file. The unused disk space is thereby maintained for the database; it is not returned to the file system.

Only offline defragmentation can return unused disk space from the directory database to the file system. When database contents have decreased considerably through a bulk deletion (for example, you remove the global catalog from a domain controller), or if the size of the database backup is significantly increased due to the white space, use offline defragmentation to reduce the size of the Ntds.dit file.

You can determine how much free disk space is recoverable from the Ntds.dit file by setting the garbage collection logging level in the registry. Changing the garbage collection logging level from the default value of 0 to a value of 1 results in event ID 1646 being logged in the directory service log. This event describes the total amount of disk space used by the database file as well as the amount of free disk space that is recoverable from the Ntds.dit file through offline defragmentation.

At garbage collection logging level 0, only critical events and error events are logged in the directory service log. At level 1, high-level events are logged as well. Events can include one message for each major task that is performed by the service. At level 1, the following events are logged for garbage collection:

  • Event IDs 700 and 701: report when online defragmentation begins and ends, respectively.

  • Event ID 1646: reports the amount of free space available in the database out of the amount of allocated space.

Setting the value of entries in the Diagnostics subkey to greater than 3 can degrade server performance and is not recommended.

Following offline defragmentation, perform a database integrity check. The integrity command in Ntdsutil.exe detects binary-level database corruption by reading every byte in the database file. The process ensures that the correct headers exist in the database itself and that all of the tables are functioning and consistent. Therefore, depending upon the size of your Ntds.dit file and the domain controller hardware, the process might take considerable time. In testing environments, the speed of 2 GB per hour is considered to be typical. When you run the command, an online graph displays the percentage completed.

Task requirements

The following tools are required to perform the procedures for this task:

  • Regedit.exe

  • Backup software

  • Ntdsutil.exe

To complete this task, perform the following procedures:

  1. Change the garbage collection logging level to 1

  2. Back up system state

  3. Use one of the following procedures:

  4. Compact the directory database file (offline defragmentation)

    As part of the offline defragmentation procedure, check directory database integrity.

  5. If database integrity check fails, perform semantic database analysis with fixup

Community Additions

© 2016 Microsoft