When you defrag, you can save disk space and improve performance. This tip suggests two ways to defrag the Active
Directory object database.
All objects in an Active Directory hosted on a Win 2000 Server are stored in a database named NTDIS.DIT and managed by an underlying Extensible Storage Engine (ESE). When filling pages, the ESE sacrifices memory efficiency for speed. Two defragmentation techniques recover the sacrificed memory.
The ESE performs online defragmentation periodically as part of the garbage-collection process. The process rearranges database pages and makes space available for new Active Directory objects. To change the online defragmentation period you need to change the garbage-collection period by modifying the garbageCollPeriod attribute in the enterprise-wide DS configuration object. Do this using any Active Directory editing tool, including Adsiedit.msc, Ldp.exe, or ADSI scripts. The path for the garbageCollPeriod of Server1 in the Company.com domain would be:
CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=SERVER1,DC=COMPANY,DC=COM
For details on other activities involved in the garbage collection process, check out http://support.microsoft.com/support/kb/articles/Q198/7/93.ASP
Online defragmentation frees up space within the Active Directory object database (NTDS.DIT) to make room for new objects. However, it does not reduce the size of NTDS.DIT, and therefore cannot return unused memory to the file system. To do that you need to take the database offline.
- Begin by backing up Active Directory, which can be done before taking the controller offline. (Use the backup wizard and either select the option to back up everything on the computer or select the option to back up the System State.)
- Reboot the domain controller and press F8 to display advanced options. Choose Directory Services Restore Mode and press Enter twice.
- Log on using the Administrator account. You'll need administrator permission to perform the defragmentation, and the security context and protection is quite different offline. If you have trouble, check out the note on the offline Security Accounts Manager (SAM) http://support.microsoft.com/support/kb/articles/Q223/3/01.ASP
- Click Start, select Programs, then Accessories, click Command Prompt, then type ntdsutil and press Enter.
- Type files, press Enter, type info, press Enter.
- You will now see the path and size of the Active Directory database and log files. Write down the path and note the size.
- Type compact to drive:directory where drive:directory is where you want to compacted file and has enough space to accept it.
- Type quit then Enter, then quit again to return to the command prompt.
- Copy the NTDS.DIT file from drive:directory to the path you wrote down in step 6.
- Reboot normally
For more background on defragmentation, check out these two articles:
Kevin Sharp is a registered professional engineer, writer, and yoga teacher living in Tucson, Arizona, and gains his expertise from a variety of professional activities. His engineering outlets include Web consulting for Supply Chain Systems Magazine, focusing on the fulfillment side of electronic commerce.
Did you like this tip? Let us know. You can drop a line to sound off.
Windows 2000 Active Directory
Author : Joe Casad
Publisher : Osborne
Published : May 2000
Explores what you can do in the new world of Active Directory, rather than just showing how to make a Windows 2000 network look and act like an NT 4.0 network. The Windows 2000 general reference books will not be able to approach this topic with this depth. Tech reviewed by the pros--Systems administrators, analysts, and MCSEs who are on the beta program testing Windows 2000 and Active Directory for their companies in the Microsoft Partnership Program have checked the book for accuracy and excellence. Expert author--Joe Casad is the best-selling author of SAMS Teach Yourself TCP/IP in 24 Hours, and two MCSE study guides from New Riders. In the industry, he is considered a networking expert and engineer. Full section on Total Cost of Ownership--Provides specific tips and examples that administrators can immediately use to reduce their networking costs. Topics include service publication, group policy integration, and Directory Object Extension. 16 pages of network blueprints--Illustrate the Active Directory Object naming system.