Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


June 2003

Using Ntdsutil to Defrag AD

Need to clean up AD? Ntdsutil gets the job done
RSS
Subscribe to Windows IT Pro | See More Active Directory (AD) Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

 See corrections to this article

If you run a Windows 2000 network, you most likely use Active Directory. AD, like most other directory services, uses a database—in AD's case, a version of the Microsoft Extensible Storage Engine (ESE)—to store information. AD is the heart and soul of Win2K, so you need to take extra care to ensure its health. Periodically using the Ntdsutil utility (ntdsutil.exe) to perform an offline defragmentation can help you achieve this goal.

Get to Know AD and Your Defragmentation Options
Before you begin working with Ntdsutil, get to know the key AD database files—edb.log, ntds.dit, res1.log, res2.log, and edb.chk—all of which reside in \%systemroot%\ntds on a domain controller (DC) by default. During AD installation, Dcpromo lets you specify alternative locations for these log files and database files, as Figure 1, page 76, shows. The best practice for a Win2K DC is to install the OS files, transaction logs, and database files on separate spindles. The most common approach is to install the files on separate mirrored drives (i.e., RAID 1).

Any change to AD triggers a write operation, which causes ESE to write all changes to both the database file and the log file. AD periodically flushes the log file as the OS commits sets of database updates. System performance determines how fast the system writes data. At process termination, AD rolls back any open transactions. During AD installation, Win2K creates the blank log files res1.log and res2.log, each of which has an initial size of 10MB. Should the system run out of disk space to store changes, AD will rename res1.log and res2.log and begin using those files.

Two types of defragmentation—online and offline—take place. By default, online defragmentation automatically happens every 12 hours as part of AD's garbage-collection process. This process runs independently on each DC, releasing free space within the AD database file. (For more information about the process, see the Microsoft article "The Active Directory Database Garbage Collection Process" at http://support.microsoft.com/?kbid=198793.) The good news about online defragmentation is that it's automatic and the DC stays online. The bad news is that online defragmentation doesn't reduce the total size of ntds.dit; it only reclaims free space from within the file. To reduce the total size of the database on disk, you must perform an offline defragmentation, which compacts ntds.dit. The easiest way to determine when to run an offline defragmentation is to turn up garbage-collection logging to level 1. Doing so causes the directory service agent (DSA) to log an event that reports the database size and the estimated amount of internal free space.

You might never need to run an offline defragmentation of AD under typical operations. However, after a major object move or a migration to Win2K, such an exercise can prove beneficial. An example of an event that might prompt an offline defragmentation is using a third-party product that creates duplicate accounts in AD, merges those placeholder accounts with the original accounts, then deletes the placeholder accounts later during a cleanup process. This type of addition and deletion can fragment AD internally, but you can use Ntdsutil to defrag and compact the database and regain needed disk space. (Note that if under typical conditions a system volume's free disk space is so small that compacting the database will significantly increase the free space, Ntdsutil might not be able to solve the problem.)

Keep in mind that because DCs only replicate changes, performing an offline defragmentation on ntds.dit on one DC won't affect ntds.dit on other DCs. Hence, you must manually perform an offline defragmentation on each DC. Because of AD's design, ntds.dit's size will differ on each DC.

   Previous  [1]  2  3  Next 


Reader Comments
I thin it is ok

konio79 May 02, 2006 (Article Rating: )


You must log on before posting a comment.

If you don't have a username & password, please register now.




Corrections to this Article:

  • In Mark England's "Using Ntdsutil to Defrag AD" (June 2003, http://www.winnetmag.com, InstantDoc ID 38945), the default tombstone-lifetime setting (the date on which marked Active Directory--AD--objects are deleted) was incorrect. The default setting is 60 days. We regret an inconvenience this error might have caused.
Top Viewed ArticlesView all articles
Friday at PASS Europe 2006

Kevin talks about the closing day of the event and shares a funny Microsoft film. ...

Escape From Yesterworld

Kevin points you to the funniest SQL Server website ever! ...

PsExec

This freeware utility lets you execute processes on a remote system and redirect output to the local system. ...


Active Directory (AD) Whitepapers Sustainable Compliance: How to reconnect compliance, security and business goals

Managing Unix/Linux with Microsoft System Center Operations Manager 2007 Cross Platform Extensions Beta

Addressing the Insider Threat with NetIQ Security and Administration Solutions

Related Events Concrete Ways to Make Sure Your SharePoint Deployment Doesn't Blow Up

Introduction to Identity Lifecycle Manager "2"

Power Up! With Virtualization Online Conference

Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

Keeping Your Business Safe from Attack: Monitoring and Managing Your Network Security

Windows 2003: Active Directory Administration Essentials

Related Active Directory (AD) Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing