Moving Active Directory database

 

Sometimes, you may need to move Active Directory database from one location to another. This location may be a different folder or different drive. When you need to do that, you are not allowed to use standard copy/move option within Windows operating system.

This kind of action is not supported when Active Directory services/Active Directory:Domain Services are running!

You need to use a tool named: ntdsutil

This is command-line tool which allows to move Active Directory database to another location.

Important! When you are moving AD database, specified location must exists! You cannot move database to non-existing drive or folder!

To move Active Directory database, you need to evaluate on which operating system version this particular Domain Controller is running

Windows Server 2003

In Windows Server 2003 you need to restart Domain Controller into Directory Services Restore Mode which is accessible when you press F8 key, during Windows system startup. Choose this mode from the list and press “enter” to run it

DSRM mode startup

DSRM mode startup

Warning! Remember, when you do that, your Domain Controller does not support Active Directory authentication and other roles/services are unavailable for users! Be aware in locations/Sites where you have only single DC, because during this operation, DC and all its roles ( i.e. DNS, DHCP) are not working!

Wait until logon screen will appear

DSRM mode logon screen

DSRM mode logon screen

Press “CTRL+ALT+DEL” and provide Directory Services Restore Mode administrator password.

Note! This password may be different (and it should be) than standard domain administrator password! If you did not change it since DC promotion, then you need to find it in your documentation before you can proceed.

DSRM mode administrator password

DSRM mode administrator password

You will be informed that server is running in Safe mode

Safe mode warning

Safe mode warning

Now, you need to start command-line where you will execute ntdsutil tool

Running command-line

Running command-line

To run ntdsutil type in command prompt

ntdsutil
Running ntdsutil tool

Running ntdsutil tool

and check if desired folder structure is available before you will move AD database. If not, create it or attach the drive into system.When you do not create a folder, it is created by ntdsutil automatically during database move process.

Warning! You cannot use removable disk to store Active Directory database. Disk needs to be NTFS formatted partition. AD DB does not support FAT/FAT32/ReFS file systems!

Veryfying target folder for AD database

Veryfying target folder for AD database

now, you need to go into files context of ntdsutil tool where you are allowed to operate on AD database files (DB and logs)

ntdsutil - file maintenance context

ntdsutil – file maintenance context

there are few options for file maintenance but in this article only 2 options are interesting for us:

  • Move DB to Path-to-the-new-location
  • Move logs to Path-to-the-new-location
File maintenance options

File maintenance options

so, let’s move Active Directory database to the new location (in this example E:ADDB)

Put this syntax into command prompt window

move DB to E:ADDB
Moving AD database

Moving AD database

and wait some time, while AD DB is being moved to the new location

AD DB is moving

AD DB is moving

As you could see in the screen above, AD DB was move with built-in command move while Active Directory services/Active Directory:Domain Services are not running!

Let’s verify if Active Directory database was moved to specified location. Just check that using Windows Explorer and go to that location

AD database new location

AD database new location

or type in command prompt inside of ntdsutil

info
AD database new location

AD database new location

ok, Active Directory database was moved and I strongly suggest to move also its log files to the same location. For that you need to use the option

move logs to E:ADDB

where E:ADDB is a folder on your server

Moving AD logs to the new location

Moving AD logs to the new location

and wait some time, while logs are being moved to the new location

AD logs are moving

AD logs are moving

OK, let’s verify if Active Directory logs were moved to specified location. Just check that using Windows Explorer and go to that location

AD logs new location

AD logs new location

All logs are in the same location as AD database. You can also verify that within ntdsutil typing

info
AD logs new location

AD logs new location

Now, you need to schedule System State backup of your Domain Controller to have an up-to-data backup with AD database and its logs in the new location.

That’s all, you may close ntdsutil by typing quit twice and close command-line window

Leaving ntdsutil

Leaving ntdsutil

Reboot server into its regular mode and you’re done!

Windows Server 2008/2008R2

With Windows Server 2008/2008R2 this process is much more quick than with previous Microsoft OSes. Windows Server 2008 introduced for the first time Active Directory role as a service. This improvement allows you to simply stop the service without rebooting a server into Directory Services Restore Mode.

What are the main benefits of this solution?

  • You do not waste time required for server reboot
  • Other services are still available for users
  • Even DNS or DHCP servers are still runnig while at least one Domain Controller is available!

Note! Please remember, when you have single Domain Controller and you stop Active Directory Domain Services service, DC will not provide services as it was in Windows Server 2003 DSRM mode!

So, how can you do that in Windows Server 2008/2008R2? The same way as in Windows Server 2003 except server reboot into DSRM mode. Just simply stop Active Directory Domain Services service and run from elevated command-line ntdsutil tool.

First of all, you have to stop Active Directory Domain Services service, run elevated command-line

Running elevated command prompt

Running elevated command prompt

and type below command to stop Active Directory Domain Services (NTDS) service

net stop ntds
Stopping Active Directory: Domain Services service

Stopping Active Directory: Domain Services service

confirm you are sure that follwing services also will be stopped by typing Y and pressing enter

Stopping dependent services

Stopping dependent services

Now, you can start ntdsutil tool to initite Active Directory database move process. Type in command-line

ntdsutil
Executing ntdsutil tool

Executing ntdsutil tool

and check if desired folder structure is available before you will move AD database. If not, create it or attach the drive into system.When you do not create a folder, it is created by ntdsutil automatically during database move process.

Warning! You cannot use removable disk to store Active Directory database. Disk needs to be NTFS formatted partition. AD DB does not support FAT/FAT32/ReFS file systems!

Target folder verification

Target folder verification

and before you are allowed to execute files context, you have to set up active AD DB instance. To do that type

activate instance NTDS
Activating NTDS instance

Activating NTDS instance

now, you can go into files context of ntdsutil tool where you are allowed to operate on AD database files (DB and logs). Type

files
ntdsutil - files maintenance

ntdsutil – files maintenance

there are few options for file maintenance but in this article only 2 options are interesting for us:

  • Move DB to Path-to-the-new-location
  • Move logs to Path-to-the-new-location
Files maintenance options

Files maintenance options

so, let’s move Active Directory database to the new location (in this example E:ADDB)

Put this syntax into command prompt window

move DB to E:ADDB
Moving AD DB to the new location

Moving AD DB to the new location

and wait some time, while logs are being moved to the new location

AD DB moved

AD DB moved

As you could see in the screen above, AD DB was move with built-in command move while Active Directory services/Active Directory:Domain Services are not running!

Let’s verify if Active Directory database was moved to specified location. Just check that using Windows Explorer and go to that location

AD DB new location

AD DB new location

or type in command prompt inside of ntdsutil

info
Active Directory database new location

Active Directory database new location

ok, Active Directory database was moved and I strongly suggest to move also its log files to the same location. For that you need to use the option

move logs to E:ADDB

where E:ADDB is a folder on your server

Moving AD log files

Moving AD log files

and wait some time, while logs are being moved to the new location

Moving AD logs

Moving AD logs

OK, let’s verify if Active Directory logs were moved to specified location. Just check that using Windows Explorer and go to that location

Active Directory logs new location

Active Directory logs new location

All logs are in the same location as AD database. You can also verify that within ntdsutil typing

info
Active Directory logs new location

Active Directory logs new location

Now, you need to schedule System State backup of your Domain Controller to have an up-to-data backup with AD database and its logs in the new location.

That’s all, you may close ntdsutil by typing quit twice

Leaving ntdsutil

Leaving ntdsutil

and now it’s time to start Active Directory Domain Services service, type in command-line

net start NTDS
Starting AD DS service

Starting AD DS service

just verify if these services were also started with AD DS service (should be ran automatically)

  • File Replication Service (NtFRS)
  • Kerberos Key Distribution Center (KDC)
  • Intersite Messaging (IsmServ)
  • DNS Server (DNS)

if so, you’re done!

Windows Server 2012/2012R2

In Windows Server 2012/2012 R2 this procedure is exactly the same as for Windows Server 2008/2008R2. All steps described for previous Microsoft operating system version apply to these two new operating systems too.

Let’s see how this procedure looks like on Windows Server 2012/2012R2

Note! Please remember, when you have single Domain Controller and you stop Active Directory Domain Services service, DC will not provide services as it was in Windows Server 2003 DSRM mode!

So, how can you do that in Windows Server 2012/2012R2? The same way as in Windows Server 2008. Just simply stop Active Directory Domain Services (NTDS) service and run from elevated command-line ntdsutil tool.

First of all, you have to stop Active Directory Domain Services service, run elevated command prompt

Running elevated command prompt

Running elevated command prompt

and type below command to stop Active Directory Domain Services (NTDS) service

net stop ntds
Stopping NTDS service

Stopping NTDS service

confirm you are sure that follwing services also will be stopped by typing Y and pressing enter

Dependent services to be stopped

Dependent services to be stopped

Now, you can start ntdsutil tool to initite Active Directory database move process. Type in command-line

ntdsutil
Executing ntdsutil

Executing ntdsutil

and check if desired folder structure is available before you will move AD database. If not, create it or attach the drive into system.When you do not create a folder, it is created by ntdsutil automatically during database move process.

Warning! You cannot use removable disk to store Active Directory database. Disk needs to be NTFS formatted partition. AD DB does not support FAT/FAT32/ReFS file systems!

Target folder verification

Target folder verification

and before you are allowed to execute files context, you have to set up active AD DB instance. To do that type

activate instance NTDS
Setting NTDS instance

Setting NTDS instance

now, you can go into files context of ntdsutil tool where you are allowed to operate on AD database files (DB and logs). Type

files
Files maintenance context

Files maintenance context

there are few options for file maintenance but in this article only 2 options are interesting for us:

  • Move DB to Path-to-the-new-location
  • Move logs to Path-to-the-new-location
Active Directory database and logs move options

Active Directory database and logs move options

so, let’s move Active Directory database to the new location (in this example E:ADDB)

Put this syntax into command prompt window

move DB to E:ADDB
Moving Active Directory database

Moving Active Directory database

and wait some time, while logs are being moved to the new location

Moving Active Directory database

Moving Active Directory database

As you could see in the screen above, AD DB was move with built-in command move while Active Directory services/Active Directory Domain Services are not running!

Let’s verify if Active Directory database was moved to specified location. Just check that using Windows Explorer and go to that location

New Active Directory database location

New Active Directory database location

or type in command prompt inside of ntdsutil

info
New Active Directory database location

New Active Directory database location

ok, Active Directory database was moved and I strongly suggest to move also its log files to the same location. For that you need to use the option

move logs to E:ADDB

where E:ADDB is a folder on your server

Moving Active Directory logs

Moving Active Directory logs

and wait some time, while logs are being moved to the new location

Moving Active Directory logs

Moving Active Directory logs

OK, let’s verify if Active Directory logs were moved to specified location. Just check that using Windows Explorer and go to that location

New Active Directory logs location

New Active Directory logs location

All logs are in the same location as AD database. You can also verify that within ntdsutil typing

info
New Active Directory logs location

New Active Directory logs location

Now, you need to schedule System State backup of your Domain Controller to have an up-to-data backup with AD database and its logs in the new location.

That’s all, you may close ntdsutil by typing quit twice

Leaving ntdsutil

Leaving ntdsutil

and now it’s time to start Active Directory Domain Services service, type in command-line

net start NTDS
Starting Active DIrectory Domain Services service

Starting Active DIrectory Domain Services service

just verify if these services were also started with AD DS service (should be ran automatically)

  • File Replication Service (NtFRS)
  • Kerberos Key Distribution Center (KDC)
  • Intersite Messaging (IsmServ)
  • DNS Server (DNS)

if so, you’re done!

Author: Krzysztof Pytko

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Leave a Reply

Your email address will not be published. Required fields are marked *