How do I
defragment the Active Directory to make
it smaller in size?
Active
Directory routinely performs online
database defragmentation, but this is
limited to the disposal of tombstoned
objects. The database file cannot be
compacted while Active Directory is
mounted (or online).
An
NTDS.DIT file that has been defragmented
offline (compacted), can be much smaller
than the NTDS.DIT file on its peers.
However,
defragmenting the NTDS.DIT file isn’t
something you should really need to do.
Normally, the database self-tunes and
automatically tombstoning the records
then sweeping them away when the
tombstone lifetime has passed to make
that space available for additional
records.
Defragging
the NTDS.DIT file probably won’t help
your AD queries go any faster in the
long run.
So why
defrag it in the first place?
One reason
you might want to defrag your NTDS.DIT
file is to save space, for example if
you deleted a large number of records at
one time.
To create
a new, smaller NTDS.DIT file and to
enable offline defragmentation, perform
the following steps:
-
Back
up Active Directory (AD).
-
Reboot
the server, select the OS option,
and press F8 for advanced options.
-
Select
the Directory Services Restore Mode
option, and press Enter. Press
-
Enter
again to start the OS.
-
W2K
will start in safe mode, with no DS
running.
-
Use
the local SAM’s administrator
account and password to log on.
-
You’ll
see a dialog box that says you’re in
safe mode. Click OK.
-
From
the Start menu, select Run and type
cmd.exe
-
In the
command window, you’ll see the
following text. (Enter the commands
in bold.)
C:\> ntdsutil
ntdsutil: files
file maintenance:info
....
file maintenance:compact to
c:\temp
-
You’ll
see the defragmentation process. If
the process was successful, enter
quit to return to the command
prompt.
-
Then,
replace the old NTDS.DIT file with
the new, compressed version. (Enter
the commands in bold.)
C:\> copy c:\temp\ntds.dit
%systemroot%\ntds\ntds.dit
-
Restart the computer, and boot as
normal.
|