DESKTOP

Windows Server 2008 : Using ntdsutil - Moving Active Directory to a Different Drive, Defragmenting Active Directory

1/1/2014 8:12:42 PM

1. Moving Active Directory to a Different Drive

You can sometimes improve the performance of Active Directory (AD) by moving the database file (ntds.dit) to a different physical drive. This can also be useful if you are running out of hard drive space. You can use the following steps to move the ntds.dit database file to a different location.

StepCommand
1.Launch a command prompt. Back up system state data with the following command. This command uses the D: drive as the backup target, but you can choose a different target based on your system. wbadmin start systemstatebackup -backuptarget:d: -quiet

Note

The Windows Server Backup feature must be installed for this step to work.

Tip

Although this step is not required, it ensures that you can recover your DC if something goes wrong. It takes some time to complete.

2.At the command, type net stop ntds and press Enter. When prompted to stop additional services, press Y to confirm. This stops AD and related services.
3.Type ntdsutil and press Enter.
4.Type activate instance ntds and press Enter.
5.Type files and press Enter.
6.Type move db to e:\ntds and press Enter.

Note

You need to substitute the drive letter e: with a valid writable drive on your system. The folder doesn’t need to exist because the move command creates it.

7.Type quit, and then press Enter twice to return to the command prompt.
8.Type net start ntds and press Enter to restart AD. After it starts, you can launch ADUC to verify that everything still works.

2. Defragmenting Active Directory

AD performs an online defragmentation every 12 hours by default. This is normally all that’s required. However, the online defragmentation does not reduce the size of the ntds.dit database file. If you have significantly fewer objects in AD than you had previously, you can shrink the size of the ntds.dit file by performing an offline defragmentation.

Tip

An offline defragmentation compacts the file, and you can compact the file only when AD is not running. You can stop the service with the net stop ntds command. It’s not necessary to reboot into Directory Services Restore Mode.


You can use the following steps to compact the database.

StepCommand
1.Launch a command prompt. Back up system state data with the following command. This command uses the D: drive as the backup target, but you can choose a different target based on your system. wbadmin start systemstatebackup -backuptarget:d: -quiet

Note

The Windows Server Backup feature must be installed for this step to work.

Tip

Although this step is not required, it ensures that you can recover your DC if something goes wrong. It takes some time to complete.

2.At the command, type net stop ntds and press Enter. When prompted to stop additional services, press Y to confirm. This stops AD and related services.
3.Type ntdsutil and press Enter.
4.Type activate instance ntds and press Enter.
5.Type files and press Enter.
6.Type compact to C:\compact and press Enter. You can use any target folder desired (other than C:\compact). Your display should be similar to Figure 1.
7.Type quit and press Enter. Type quit and press Enter again. This returns you to the command prompt. Although the following steps aren’t required, they help ensure that you can return to the original configuration if something goes wrong.
  1. Create a backup folder named ntdsbu in the root of C by typing md C:\ntdsbu and pressing Enter.

  2. Type copy C:\windows\ntds\ntds.dit C:\ntdsbu\ntds.dit and press Enter.

    Note

    If you moved the ntds.dit file, you need to substitute the C:\windows\ntds folder for the actual location.

  3. Type copy C:\windows\ntds\*.log C:\ntdsbu and press Enter.

    Note

    These steps create backup files of the ntds.dit AD database and the AD logs. If the ntds service is unable to restart, you can simply copy these files back to their original location.

8.Type copy C:\compact\ntds.dit C:\windows\ntds\ntds.dit and press Enter. When prompted to confirm the overwriting, type Y for yes.
9.Type del C:\windows\ntds\*.log and press Enter.
10.Type net start ntds, and press Enter. This restarts the ntds service. After it starts, you can launch ADUC to verify that everything still works.

Figure 1. Performing an offline defragmentation

Other  
  •  Windows Server 2008 : Using ntdsutil - Resetting the Directory Services Restore Mode Password, Changing the Garbage Collection Logging Level
  •  Windows Server 2003 : Deploying Stub Zones - Benefits of Stub Zones, Stub Zone Updates
  •  Windows Server 2003 : Creating Zone Delegations - Delegating Zones
  •  Windows Server 2003 : Configuring Advanced DNS Server Properties (part 2)
  •  Windows Server 2003 : Configuring Advanced DNS Server Properties (part 1)
  •  Windows 7 : Working with the Multi-Touch User Interface (part 3) - Adding Multi-Touch Interface Functionality
  •  Windows 7 : Working with the Multi-Touch User Interface (part 2) - Obtaining the Multi-Touch Platform Interop Library, Configuring the Application
  •  Windows 7 : Working with the Multi-Touch User Interface (part 1)
  •  Windows Server 2003 : Configuring Zone Properties and Transfers (part 4)
  •  Windows Server 2003 : Configuring Zone Properties and Transfers (part 3)
  •  
    Top 10
    3 Tips for Maintaining Your Cell Phone Battery (part 2) - Discharge Smart, Use Smart
    3 Tips for Maintaining Your Cell Phone Battery (part 1) - Charge Smart
    OPEL MERIVA : Making a grand entrance
    FORD MONDEO 2.0 ECOBOOST : Modern Mondeo
    BMW 650i COUPE : Sexy retooling of BMW's 6-series
    BMW 120d; M135i - Finely tuned
    PHP Tutorials : Storing Images in MySQL with PHP (part 2) - Creating the HTML, Inserting the Image into MySQL
    PHP Tutorials : Storing Images in MySQL with PHP (part 1) - Why store binary files in MySQL using PHP?
    Java Tutorials : Nested For Loop (part 2) - Program to create a Two-Dimensional Array
    Java Tutorials : Nested For Loop (part 1)
    REVIEW
    - First look: Apple Watch

    - 3 Tips for Maintaining Your Cell Phone Battery (part 1)

    - 3 Tips for Maintaining Your Cell Phone Battery (part 2)
    VIDEO TUTORIAL
    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
    Popular Tags
    Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS