Recipe 16.15 Determining the Size of the Active Directory Database

16.15.1 Problem

You want to determine the size of the Active Directory database.

16.15.2 Solution Using a command-line interface

If you are in DS Restore Mode, you can use ntdsutil to report the size of the Active Directory database:

> ntdsutil files info

If you are not in DS Restore Mode and run this command, you will receive the following error message:

*** Error: Operation only allowed when booted in DS restore mode

As you can see, it is possible to override this failure by setting the SAFEBOOT_OPTION environment variable to DSREPAIR, but I do not recommend this unless you know what you are doing. By setting that environment variable, the ntdsutil command will not stop you from performing other commands. This can be very dangerous.

Another method, which is safer and easier, is to bring up a command shell by going to Start Run, typing cmd.exe, and pressing Enter. Then type cd <NTDSDir>, where <NTDSDir> is the full path to the ntds.dit file. Finally, run the dir command; the output will show the size of the files.

16.15.3 Discussion

The size of the Active Directory database on a domain controller is effectively the size of the ntds.dit file. This file can vary slightly in size between domain controllers even within the same domain due to unreplicated changes or differences with nonreplicated data.

You should monitor the size of this file on one or more domain controllers in each domain to ensure you have adequate disk space. Also, by knowing the average size of your DIT, you can recognize if it spikes dramatically, perhaps due to a new application that is writing data to the directory.

If you find that you are running out of disk space, you have a couple of options. You could move the Active Directory files to a new drive with more capacity. Alternatively, you can perform an offline defragmentation if the DIT file contains a lot of whitespace.

16.15.4 See Also

Recipe 16.8 for moving the DIT files, Recipe 16.11 for determining how much whitespace is in the DIT, and Recipe 16.12 for performing an offline defragmentation of the Active Directory database

    Chapter 3. Domain Controllers, Global Catalogs, and FSMOs
    Chapter 6. Users
    Appendix A. Tool List