It can happen that the paths or the storage location of Exchange databases and log files have to be changed, for example when changing the storage system. This article is in response to a reader's question about how to do this with as little downtime as possible.
There are several options for moving the database and log file paths, the possibilities are described below.
The surroundings
My small Exchange test environment has to be used again for this article. The test environment is ideal because the database and log file paths are configured very poorly here. The database and log files are located on the C drive, so I can use this article to straighten out the environment.
There are two Exchange servers, both are members of a DAG, both servers host an active database and a passive database. Here is an overview:
Here is an overview of the databases:
The database paths for the EDB file and log files are therefore each located under "C:\Program Files\Microsoft\Exchange Server\V15\Mailbox".
Both Exchange servers have now been given an additional data carrier for the future paths of the database and log files. The aim is for the database and log files to be stored on disk 1:
Although the servers here run with Exchange Server 2019 on Windows Server 2019, the options described below also work from Exchange Server 2010 and earlier operating systems.
Option 1: New database
Instead of changing the paths of a database, you can also simply create a new database and migrate the mailboxes to the new database. This procedure is considerably more time-consuming than changing the paths, but at least no downtime is required.
The procedure:
- Create new database and database copies
- Move mailboxes to the new database
- Delete old database if all mailboxes have been moved
I don't think I need to describe the procedure in detail here. If this is desired, I will be happy to provide it later.
Note: Exchange Server 2016/2019 in the Standard Edition can host a maximum of 4 active databases. When creating new databases, you must therefore bear this limit in mind.
Option 2: Move paths
The second option is to change the database paths. This is very easy to do via the Exchange Management Shell. In this case, however, the database is switched offline. While the database is being moved, Outlook cannot connect to the mailbox.
It should be borne in mind that this is technically a copying process. There must therefore be enough storage space available (important if the database is moved to another folder on the same data carrier).
Changing the paths can take a little longer depending on the size of the database and the speed of the memory. Sufficient time and downtime should therefore be planned here.
The procedure:
- Perform a full backup of the database
- Remove passive database copies
- Move database
- Add database copy again
Unmounting the database, moving the data and mounting the database is done by Exchange, but removing the copy and adding the database copy is a manual task.
The full backup of the database is not so much for security purposes, but rather for speed optimization. After the full backup, the transaction logs of the database are deleted, so only a few log files are available after the full backup. When the database is moved, many small files no longer need to be moved, but essentially only the one large EDB file.
The procedure in detail:
First, the new disks must be partitioned and formatted on both Exchange servers (the drive letter or mount point must be the same on all Exchange servers). For this environment, I have formatted the data carrier with NTFS (ReFS is also possible) and mounted it as drive E::
A folder with the name "DB1" was created on the E: drive on both servers. This is the new target path of the database.
All passive copies of the database must now be removed:
NotePassive database and log files are only removed from the configuration here. The files remain on the file system and must be deleted manually.
The database DB1 no longer has any copies:
The database can now be moved to the new volume E:. While the database is being moved, the database is offline. Connections from clients to the database are therefore not possible. Depending on the size of the database, the speed of the memory and the number of log files, a longer downtime must be planned here.
The database can be moved with the following command:
Move-DatabasePath DB1 -EdbFilePath E:\DB1\DB1.edb -LogFolderPath e:\DB1
After the database has been moved, the database is also directly integrated again. The copy can now be added again:
The database is now transferred from the active server to the passive server, which can also take some time.
Option 3: Mountpoints
The last method requires a little more manual effort, but the paths of a database can be changed without having to take it offline. The database can only be taken offline briefly for cosmetic purposes, but as no more data needs to be copied, the database is quickly back online.
Mountpoints can be used for this method. The rough procedure:
- A copy of the database is removed
- The new data carrier is mounted in the old path of the database instead of with a drive letter
- The copy is added again
- Repeat for all database copies
Correct blemishes
For option 3, the active database is first switched to the passive copy (switch-over):
The passive copy of the database is now removed. In this case, the copy on server EX1 is removed:
Now switch to the database folder on server EX1, where the data of the copy that has just been removed is still located:
The entire contents of the folder must now be deleted so that the folder is completely empty:
The path from the address line can now be copied. A new volume is now created on the empty data carrier 1:
The partition is now not given a drive letter, but is mounted in the empty folder (where the database was until just now, but which has been emptied):
After the partition has been formatted, it now appears as follows in Explorer:
It is important that the path and the name of the folder are not changed.
A copy can now be added again for database DB1:
The copy is now saved again on the EX1 server (the copy that was removed at the beginning):
After successful replication (be sure to wait for complete replication), both copies are error-free again:
Data is also visible again in Explorer (but now the data is on data carrier 1):
The path "C:\Program Files\Microsoft\Exchange Server\V15\Mailbox\Mailbox Database 1960189437" no longer points to disk 0 (drive C) but to disk 1, which was only mounted under this path.
To ensure that both servers now use data carrier 1, the database DB1 is now reactivated on server EX1 (switch-over or switch-back again):
The copy on server EX2 is then removed:
Now empty the folder on EX2 and copy the path to the clipboard:
Disk 1 is mounted in the local folder again:
Finally, the copy on Server EX2 is added again; after replication of the database, both copies are displayed as error-free again:
The method shown here works with almost no downtime, as there are only two switch-overs of the database. Depending on the environment, Outlook loses the connection (online mode) for a short time at most, but then re-establishes it.
This method is not completely elegant and clean, but you can still rework and correct the blemish in a quiet minute and with minimal downtime. Both methods only require a few minutes of downtime.
Option 3.1: Move mountpoint
To move the mountpoint from disk 1 (C:\Program Files\Microsoft...) to a somewhat simpler path, a new folder structure can be created, for example, I have provided the path "C:\Mountpoints\DB1" for DB1 and created these folders accordingly on both Exchange servers:
This folder structure must be created on both Exchange servers. As soon as the folder structure exists, the database DB1 can be switched offline (this should of course happen within a maintenance window):
The path for data carrier 1 can now be changed:
Disk 1 is now mounted in the folder "C:\Mountpoints\DB1\":
The data is now available in the new folder, so nothing needs to be moved, only the configuration of the database needs to be adjusted. This can be done with the following command:
Move-DatabasePath DB1 -EdbFilePath "C:\Mountpoints\DB1\Mailbox Database 1960189437.edb" -LogFolderPath "C:\Mountpoints\DB1" -ConfigurationOnly
As soon as the configuration of the database has been adjusted, the database can be mounted again:
The database path now points to "C:\Mountpoints\DB1\":
The process only takes a few minutes as no more data is moved/copied.
Option 3.2: Change mount point to drive letter
If you don't like mount points, you can also switch to a normal drive letter. The procedure is quite similar, first the database is switched offline:
The mount point is then removed and a drive letter is assigned, in this case it is E:\:
To do this properly, a new folder DB1 is now created under E:\ on both Exchange servers (this is necessary because the logs must not be in the root E:\):
The data from E:\ is moved to the subfolder DB1. This means that all data that was previously directly under E:\ is now in the E:\DB1 folder. The move is normally completed within a few seconds, as the data is already on data carrier 1:
Now the configuration of the database can be adjusted again, this time to the new drive letter and folder:
Move-DatabasePath DB1 -EdbFilePath "E:\DB1\Mailbox Database 1960189437.edb" -LogFolderPath "E:\DB1" -ConfigurationOnly
Mount the database and you're done:
If I had been really neat here, I would have renamed the EDB file to DB1.edb and only then changed the path/configuration.
Conclusion
You do not have to wait long for the database to be moved by shell (option 2) or first create a new database and move the mailboxes (option 1). There is a little trick (option 3).
Another small note: Option 3 only allows one database per data carrier, if database DB2 is also to be moved, a new data carrier must be provided for this. Disk 1 can no longer be used here. Unless you want to move both databases at the same time, then this would be possible...