Skip to content

Move Exchange DAG database to another drive

You have a DAG setup, and the mailbox database disk is getting full. However, when you try to move the mailbox database with Exchange Management Shell, you get an error that it’s not allowed for replicated databases. In this article, you will learn how to move an Exchange mailbox database in DAG setup to another drive.

Introduction

We have a DAG setup with two mailbox servers:

  • EX01-2019 (active mailbox databases)
  • EX02-2019 (passive mailbox databases)

We want to move the mailbox database DB01 on drive (E:) to another drive.

Mailbox database drive full

Move-DatabasePath is not allowed for replicated databases

In the previous article, we showed how to move the Exchange database to another drive. However, if we go through the same steps for a replicated database, it will not work, and an error will show up. Let’s have a close look at the error.

Run Exchange Management Shell as administrator. Next, run the Move-DatabasePath cmdlet to move the mailbox database to another drive.

An error shows up:

Move-DatabasePath is not allowed for replicated databases. For detailed steps to change the location of a replicated database, see the Help file topic, Move the Mailbox Database Path for a Mailbox Database Copy.

[PS] C:\>Move-DatabasePath "DB01" -EdbFilePath "I:\DB01\DB01.edb"
Move-DatabasePath is not allowed for replicated databases. For detailed steps to change the location of a replicated
database, see the Help file topic, Move the Mailbox Database Path for a Mailbox Database Copy.
    + CategoryInfo          : InvalidOperation: (DB01:ADObjectId) [Move-DatabasePath], InvalidOperationException
    + FullyQualifiedErrorId : [Server=EX01-2019,RequestId=807bc485-6feb-4927-b209-823a1419c4c2,TimeStamp=2/24/2022 10:
   34:42 PM] [FailureCategory=Cmdlet-InvalidOperationException] AFF4B29C,Microsoft.Exchange.Management.SystemConfigur
  ationTasks.MoveDatabasePath
    + PSComputerName        : ex01-2019.exoip.local

Why is this happening, and how to move a mailbox database that’s replicated?

How to move Exchange DAG replicated database

To move a mailbox database that’s replicated, you need to go through the below steps.

Remove mailbox database copies

Remove all mailbox database copies for the database you want to move:

  • Click on servers > databases
  • Select the mailbox database
  • Click on Remove

In our example, we like to move the mailbox database DB01. So we will remove mailbox database copy DB01.

Move Exchange DAG database to another drive remove copy mailbox database

A warning shows that the copy of mailbox database has been removed.

Note: The database and log files are still available on the Exchange Server, and you should NOT delete them. These files are being preserved so the database copies don’t require re-seeding after they have been re-added.

Move Exchange DAG database to another drive copy mailbox database removed

Create disk with empty space

Create a disk and configure a volume by following the article Configure ReFS volume Exchange 2013/2016/2019.

PS C:\> Get-Disk 5 | Initialize-Disk -PartitionStyle GPT -PassThru | New-Partition -UseMaximumSize -DriveLetter I | Format-Volume -FileSystem REFS -AllocationUnitSize 65536 -NewFileSystemLabel "DB01 Data" -SetIntegrityStreams $false

In our example, we have a 100 GB disk with the name DB01 Data and drive letter (I:).

New disk

Move mailbox database path

Run the Move-DatabasePath cmdlet to move the mailbox database to the new location. The EdbFilePath parameter specifies a new file path for the database. All current database files are moved to this location.

After running the command, confirm both times with Y and press Enter.

Important: The database will dismount, and the files will move to the new location. After the files finish moving, the database is mounted. Everything will happen automatically. The time of the operation depends on how much data there is to move. The users configured in the mailbox database will have no access to their email. It’s recommended to do this after business hours.

[PS] C:\>Move-DatabasePath "DB01" -EdbFilePath "I:\DB01\DB01.edb"

Confirm
Are you sure you want to perform this action?
Moving database path "DB01".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [?] Help (default is "Y"): Y

Confirm
To perform the move operation, database "DB01" must be temporarily dismounted, which will make it inaccessible to all
users. Do you want to continue?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [?] Help (default is "Y"): Y

This is how it looks after the DB01 database moved from drive (E:) to (I:) on EX01-2019.

Move Exchange DAG database to another drive mailbox database moved

Create folder structure

Create the necessary folder structure on each Exchange Server that previously contained a passive copy of the moved mailbox database. It needs to be identical to the other Exchange Server.

In our example, we will follow Configure ReFS volume Exchange 2013/2016/2019 and create a 100 GB disk with the name DB01 Data and drive letter (I:) on EX02-2019. Just like we did in the previous step on EX01-2019.

Move Exchange DAG database to another drive new disk

Move passive copy mailbox database

Move the passive copy of the mailbox database and its log stream to the new location.

Start File Explorer and navigate to the source drive location where the passive copy is available. Then, move the mailbox database folder to the destination drive location.

In our example, the folder DB01 from (E:) drive to (I:) drive.

Move Exchange DAG database to another drive move mailbox database

This is how it looks after the mailbox database move finishes on EX02-2019.

Move Exchange DAG database to another drive mailbox database moved

Add all database copies

Add all the database copies that were removed:

  • Click on the mailbox database
  • Select the more button
  • Click on Add database copy
Move Exchange DAG database to another drive add database copy
  • Click on the Browse
  • Select the Exchange Server
  • Click on Save

In our example, it’s Exchange Server EX02-2019.

Move Exchange DAG database to another drive select Exchange Server for hosting the database copy

Restart Exchange service

Start Windows PowerShell on each server that contains a copy of the mailbox database. Then, run the cmdlet Restart-Service MSExchangeFastSearch to stop and restart the content index services.

In our example, that’s on EX02-2019.

PS C:\> Restart-Service MSExchangeFastSearch

Verify your work

Check that the BAD COPY COUNT is 0, which means that everything is in sync between the active and passive database.

Move Exchange DAG database to another drive verify database health

Activate the passive mailbox database, and it will work as you expect.

Move Exchange DAG database to another drive activate database copy

Don’t forget to remove the empty disk drive.

Remove old empty disk

You successfully did move a replicated mailbox database in a DAG configuration to another drive.

Read more: Exchange database best practices »

Conclusion

You learned how to move the Exchange DAG database to another drive. It’s only possible to move the Exchange database to another drive with PowerShell. Move Exchange database path to another drive outside business hours. Otherwise, the users with a mailbox in that mailbox database cannot connect to their email.

Another option is to move all mailboxes to another database. After that, remove the database copy and delete the mailbox database. However, that will take more time, and it needs to replicate the data to the other database copies, which will cause load and data transfer.

Did you enjoy this article? You may also like to read Mailbox server cannot be removed from DAG. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 11 Comments

  1. Hello Ali,

    I have question about moving database in DAG. I have 2 dag members, and our databases are on drive M, from what i just found out that the team configuring exchange made mistake and configured drive M on the second server as MBR and I cant exted it more than 2TB.

    I thought about making new drive, lets name it N as gpt, turning off all services on second server, doing robocopy of the whole drive, then change letters and turn on services. Do you see this as valid option? I have enough space on nas to extend this partition just cant do it because of drive type.

    1. That should work.

      But I recommend the following:

      – A database size of 2000GB per database or less in a DAG environment
      – A database size of 200GB per database or less in a standalone Exchange Server environment

      1. Thank you for your fast response 🙂

        I have 2 databases for about 1000GB each, so its not a problem.
        Or maybe you mean i shoudnt make each drive bigger than 2000GB?

  2. Hi Ali,
    Thanks for your article.
    If I just want to change/move “log files” to a newly create LOG partition (ie. L drive) on both Active(ex01)/Passive(ex02) and leave DB partition “no change”.
    Without removing complete copy, can I just use
    move-databasepath “db01” -logfolderpath L:\
    Please advise
    Thanks.

    1. Hi Eden,

      That command is almost correct (you will get an error because you can’t use the root directory).

      The correct command will look like this:

      Move-DatabasePath "DB01" -LogFolderPath "L:\DB01"

      Unfortunately, you must remove the mailbox database copy before running that command. Otherwise, you will get the error as shown in the article.

      In your case:

      1. Remove the mailbox database copy
      2. Run the command to move the mailbox database log folder
      3. Add the mailbox database copy
      4. Give the logs replication a couple of minutes of time
      5. Verify that the logs are shown in the correct path on both the Exchange Servers
      6. Remove the old log folder on the passive Exchange Server

  3. Hello Ali,

    Thanks for this great article is very helpful
    I’ve a question please can I use the above steps to migrate database from old storage to new storage not just another lUN in same storage
    We’ve 16 server as member of Exchange DAG

  4. Hello Ali,

    your courses are awesome ! Thank you for your sharing.
    I have a question about this section.
    Why did you move the passive copy of DB01 on your EX02-2019 from Volume E to Volume I.
    Could’nt you skip this stage ? Because after all we have already copied the DB again via EAC.
    Actually i have completed this section seamless but i would learn this.

    Thank you for your answer.

    1. Hi Emre,

      Glad you find the courses useful.

      Moving the passive database copies will not require re-seeding after the database copies have been re-added (as written in the article).

      If you don’t do this, it will re-seed to the passive database copies, using server performance and taking time.

      So you can skip this step, but I don’t recommend that unless you have a mailbox database that is small in size.

Leave a Reply

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