The Microsoft Exchange certificate is installed when you install an Exchange Server, and it's 5…
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.
Table of contents
- Move-DatabasePath is not allowed for replicated databases
- How to move Exchange DAG replicated database
- Verify your work
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.
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.
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.
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:).
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.
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 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.
This is how it looks after the mailbox database move finishes on EX02-2019.
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
- Click on the Browse
- Select the Exchange Server
- Click on Save
In our example, it’s Exchange Server EX02-2019.
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.
Activate the passive mailbox database, and it will work as you expect.
Don’t forget to remove the empty disk drive.
You successfully did move a replicated mailbox database in a DAG configuration to another drive.
Read more: Exchange database best practices »
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.