Home » Exchange Server » How to Move an Exchange Server 2013 Database to a New Location

How to Move an Exchange Server 2013 Database to a New Location

When you install a new Exchange Server 2013 Mailbox server a database is automatically created on the server as well.

The database is located in the Mailbox folder of the Exchange installation path, which by default is the C: drive therefore a mailbox database will be placed in a path such as:

C:Program FilesMicrosoftExchange ServerV15MailboxMailbox Database 1

Usually this default location is not suitable, so you have two choices:

  • Remove the database and create a new one in the desired path
  • Move the existing database to the desired path

To move a database to a new location use the Move-DatabasePath cmdlet in the Exchange Management Shell.

Before you proceed please be aware that:

  • the command must be run while logged on to the mailbox server hosting the database
  • this process requires that the database be dismounted while the move takes place, making it unavailable for mailbox users
  • this process should not be followed for databases that are replicated within a Database Availability Group
  • this process cannot be run at the same time as a backup is in progress

Also consider that for non-replicated databases the best practice is still to separate the database file and transaction logs onto separate disks.

To move an Exchange 2013 database named “Mailbox Database 1” to a new EDB file location of E:Mailbox Database 1 and a new logs folder of F:Mailbox Database 1 the following command is used.

To check whether the database is mounted and accessible again you can run the following commands.

Paul is a Microsoft MVP for Office Servers and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul is a co-author of Office 365 for IT Pros and several other books, and is also a Pluralsight author.
Category: Exchange Server

72 comments

  1. Bob says:

    THat is great info on how to move a database.

    How does one change the DEFAULT database location, or do we have to set it each time we create one?

    • If you run “Get-MailboxServer | select *datapath*” you’ll see the default data path. If I recall correctly it can’t be changed via a PowerShell command but can be changed using ADSIEdit.msc

  2. Joe Tuccillo says:

    For some reason I can not view my database in the EMC Servers > Database page of the ECP. I was able to move it through the shell but now can not see it to mount/dismount in the ECP? Any ideas why? Mail is flowing and everything else appears to be working. Thanks.

  3. Hesan says:

    Hello, I want to move the log files to different directory, i just want to know if i move the logs will the database be dismounted during the log move??
    Thank You

  4. Nausherwan says:

    I want to move my database file path only, I am running exchange 2013 CU2 in production. All databases are running in DAG and they have copies on other server, I want to change 4 Databases path from current location to other at both DAG members.
    Please confirm me about how to do this

  5. Eric says:

    Hi Paul,

    Thanks for this instructive article, as usual on all your site!

    Since the process you described cannot be followed while my current database is on a 2 nodes DAG (2013 version),
    should i remove the DAG first and then recreate it again or is there a specific process allowing me to preserve it while doing the change ?

    Just to mention that i want to change the database location on only one node (in fact from one iscsi volume to another inside that same node)

    Thank you for your help.

  6. Graeme says:

    Hi Paul,

    I needed to move one database (part of a DAG) to a new location…
    I removed the database copy and then successfully moved the location, remounting without issue.
    I then added a new database copy and allowed it to recreate the copy on the 2nd DAG member from scratch.
    All went well.
    However… Although the Passive copy is Healthy, the Content Index State is FailedandSuspended and none of your previous tips help.
    I have tried removing the copy again, and recreating it again but to no avail.
    Do you have any suggestions?

    Thanks

    • If doing a reseed of the catalog only isn’t working try stopping search services on the failed node and deleting then content index folder for that DB copy, then start the services again. Give it 15-30 minutes to sort itself out then see if its healthy after that.

      Edit: I probably should have read the whole conversation below first. Looks like you’ve already done this.

      • Graeme says:

        Thanks Paul,

        I had already tried that.
        Do you have any experience with the Troubleshoot-CI scripts on Exchange 2013?
        Otherwise, looks like my only remaining option is to create a new DB and migrate the users mailboxes.

  7. Nausherwan says:

    Hi Graeme,

    I faced the same issue, after moving database location to new path, kindly update manually database copy (reseeding) and wait for 1-2 days, it all depends on the size of db file, when it will converge, content index state will be in healthy state.

    Regards,

  8. Graeme says:

    Hi Nausherwan,

    Thanks for your reply.
    I have been trying to resolve for 4 days. It is only a 5Gb database (7 users)
    I have tried manually updating the database copy, no change.
    Also tried:
    …Rebooting
    …Changing the Activation Preference
    …Removing the search folders (with Search services stopped and restarted)
    …Added ContentSubmitters AD Group (again with appropriate service stops and starts)

    Since Exchange 2013 (CU3) on 2012R2, not sure if I should modify the Troubleshoot-CI.ps1 to use the 2013 registry settings (Microsoft seem to have not updated the script for 2013… frustrating)

    I have other databases on this DAG, including new ones created in the past 2 days and no other issues.

    My last option seems to be to create a new mailbox database, add the copy, test replication, then move the users to the new mailbox database, finally retiring the old one. This seems extreme but I’m sure would fix the problem. My concern is if this happens to other mailbox databases…..

    Thanks

  9. Nausherwan says:

    have you tried this command with healthy source server switch, if it works

    Update-MailboxDatabaseCopy “dag2db1mbox1” -CatalogOnly -sourceserver

  10. Graeme says:

    Yep.
    The command should use the healthy source server by default, but I have also tried casting it explicitly.
    Again, thanks.

  11. Nausherwan says:

    To avoid any other issue, last option is to create new DB and its copy on other DAG member, move all users in New db, so that you can have alteast backup of that DB in the shape of DB copy in DAG.

    • Graeme says:

      Like I said though, that is a bit extreme and I’d rather understand and fix the problem so that if it happens to another database I can resolve again.

  12. Tom says:

    I’m trying to move the database on exchange 2013. We are running exchange server using hyper-v on server 2012.

    I RDP into the mail server, open an exchange management shell using admin priv, but when the shell opens I get the warning ” Cant generate Export-module for the current session using Import-PSSession”

    When I run the command: “Move-DatabasePath “Mailbox Database xyz” -EdbFilePath “D:mailstoreMailstore1.edb” -LogFolderPath “D:Mailstore”

    I get an error that the term ‘move-databasepath’ is not recognized.

  13. Steve Rackham says:

    Hi All
    I have inherited an exchange 2013 environment with a misconfigured DAG.
    It was initially configured with four servers (two DAGs with two nodes per DAG).
    I have reconfigured so that there is one DAG with all four MBX members as nodes.

    Unfortunately, when attempting to add-databasecopy I get this error –
    An existing database is already configured with the same location “E:logs” for LogFolderPath.

    So, I need to to move the databases to each of there seperate folders.
    Currently set wtihout seperate folders :-/ lumped under a folder called databases and a log folder called Logs.
    I am better to create new databases? What is the process for moving a DAG database and Log path?

    Thanks for your help and good article.

    S.

    • So let’s say you’re trying to add a copy of DB01 to SERVER03… but SERVER03 already hosts a *different* database in the same DB/log paths as DB01.

      If that is the case, and that database has only a single copy right now, then you should be able to do the database move as shown in the article. It is only an issue moving database paths in DAGs for databases with more than one copy as far as I know.

      • Raman says:

        Hi Paul,
        I just wanted to confirm, we are Exchange 2013 SP1 in DAG. We have 1 Active and 1 Passive copies of all DBs. Currently we have all DBs are in separate folders. Ex: DB1 has a separate folder on F:DB1 and this folder has DB1.edb and DB1 Logs as well. DB2 has its own separate folder F:DB2 and this folder has DB2.edb and DB2 logs.
        Do I need to move EDB files and Log files of same DB in separate folders as well?
        Thanks,
        Raman

  14. Tofik says:

    Hi Paul,

    I have an Exchange 2013 server which is also a DC and DNS server. Now, I need to move it from there to a new server and remove the current server from my environment. The exchange is running on Microsoft Windows 2012 R2. Is there any step by step guide?

    Thank you,
    Tofik

  15. Dominik says:

    It’s been high time I thanked you for all those great tips you post on this blog, you’ve saved my bacon on more than one occasion already!

    Keep up the great work!

  16. Matt says:

    “This operation cannot be performed on a remote server. Please use the -ConfigurationOnly option and then manually move the files” From every server I have run this command on regardless of where the log files and the db files are located.

    Command simply does not work in any way at all from what I can see. Same error when logged into the server hosting the db and logs as when not.

  17. Abhijeet says:

    Hi Paul,

    I have exchange 2013 which have 2 DAG’s with 2 DB’s, which is running X (SAN)Storage , I need to migrated to Y (SAN) storage without impacting users , Due to lack of storage space in existing SAN future requirement

    Please advice migration method

      • Abhijeet says:

        Hi Paul,

        Thanks your advice ,

        1. How to calculate, how many mailbox’s. I can be migrate in a days, As I have 14 TB Data ( is any calculator available )

        2. Are you advising to Create New DAG for New database on new SAN, then move mailboxes from source DB to New Target DB ?

        Please advise

  18. Abhijeet says:

    Thank you so much …

    So you are adviseing add this new database in existing DAG

    I have same size of db size 14 TB on DR location also, so once I move mailbox from old db to new db it will replicate to passive copy which is in DR location, am I correct?

    • Yes. Create the new database on one of your DAG members, then add a copy of that database to your other DAG members. Everything you migrate into that new database will then automatically be replicated to the other copies of that database.

  19. ghogho says:

    OK moved DB&Logs!
    How about some leftover dir –
    22D2AF5B-1709-4568-BCAC-B7A78E9805D212.1.Single
    in the old base location can I trash it?

  20. Mark Wall says:

    Thank you for a great article. For me, the “Check Database is Mounted” section failed after the change until I realised ECP keeps the old display name, despite moving everything else perfectly and correctly naming the database after the move. To check it worked and change the display name

    https://yourexchangeserver/ecp
    Log on with an administrative account
    Click Servers
    Select the database with the old name ie Mailbox Database 1234567890
    Edit using the pencil
    Change the display name to Mailbox Database 1 (you will see at this point that your database really is on E: and it is actually named “Mailbox Database 1”

    Thereafter Exchange Administrative Shell commands work for “Mailbox Database 1”

    I hope this helps anyone else wondering why they get an error running the following command after a move

    Get-MailboxDatabase -Status “Mailbox Database 1” | Select Name,Mounted

  21. Steve says:

    I ran the command move-databasepath -identity “Mailbox Database 1439531171.edb” -edbfilepath “e:MicrosoftExchangeDataMailbox Database 1439531171.edb” to move the database to the new path. Was logged into and running the command from my exchange server. However, I get the error:

    The operation couldn’t be performed because object ‘Mailbox Database 1439531171.edb’ couldn’t be found on ‘domaincontroller.corp.blah’.

    When I run
    [PS] C:Windowssystem32>get-mailboxdatabase -identity “mailbox database 1439531171”

    it shows me the correct server:

    Name Server Recovery ReplicationType
    —- —— ——– —————
    Mailbox Database 1439531171 EXCH2013 False None

    How can I get it to look on the exchange server for the database?

  22. Mike Cockrall says:

    I am about to move a 500gb database to a new volume and was wondering if anyone has a rough amount to time this will take to not affect users too much. The data is on extremely fast drives on the same drive array.

  23. Andrew Morris says:

    Great article, however, I have a strange problem that still exists. I was decided to move a database to another drive on the server as I wasn’t able to seed it to the other server in the DAG. It would get close to the end of seeding and then log an event 107 to say a serious I/O error had occurred. As I wanted to eliminate the storage I followed your guide and successfully moved the database to a different drive, however, when it came to adding the server into the DAG and seeding, it threw the same error. (I should also note that I had seeded 2 other databases that were bigger than this on the original drive without issue). The database is mounted on 1 server and Healthy, but I really need to have it on the other for redundancy.

    The servers are 2012R2 VM’s and my next thought is to try replacing the current E1000 NICs with VMXNET3’s – although they didn’t cause any issues when reseeding other databases.

    Any ideas would be appreciated.

    Cheers,

    Andrew

  24. Andrew Morris says:

    I had tried the reseed process with AV disabled, but had the same result.

    I’m in the process of moving the mailboxes off the database and I will then remove it and recreate.

    Cheers,

    Andrew

    • So there is AV… but have you configured the required exclusions?

      “Disabled” is pretty meaningless for a lot of today’s AV/security products. They are often still running and messing with stuff even when you’ve disabled them.

  25. Andrew Morris says:

    I was able to delete the database and recreate, then add the database copy successfully on the other DAG member. The only problem I had was when trying to remove the old log directory before the recreation – seems that there was a corruption with the incseed folder – perhaps that could have caused the problem with me not being able to reseed the database? I was able to rename the log folder though to allow me to reuse the name for the new database.

    Cheers,

    Andrew

  26. Infopath says:

    Hi Paul, great site with lots of info! I am wondering if you can provide me with some direction on migrating mailboxes off of our current databases/volume onto a different database/volume. We have 2 Exchange 2013 servers running in a DAG with 6 databases. I want to consolidate the remaining mailboxes, totaling about 20 GB or so (most have been migrated up to 365) that we still need on-prem into 1 database and then move that database onto a separate smaller volume located on both Exchange servers.. After moving the database over, I would like to delete the old volume ( 3 TB) and reuse that disk space on our SAN for other things. What is the best way to go about this? Do you have any step by step instructions for my situation? Would it be best to create a new DB on the existing volume, move mailboxes to that new database, and then move the database/logs to the new volume?

    Thanks for any advice!

    • Moving a database involves an outage, so it is a disruptive change. So your plan should avoid that if possible. I would create the new database on the new storage location that you want it to live permanently on, and then simply move mailboxes to it.

      • Infopath says:

        Yes, avoiding an outage would definitely be ideal. So, in your scenario, there would not be an outage? I would also need to move over the ‘Logs” folder also? Currently, we have the DB files and log files in the same volume. At that point after the move to the new location, we should be able to remove the volume that housed the original databases?

        Thanks!

        • Mailbox moves occur online and the only disruption to the end user is the final cutover, which takes a few minutes. And you can control the timing of that, so it is effectively non-disruptive for end users.

          If instead you choose to move the database, then yes you need to move logs as well. In the article above I demonstrate how both are moved with the Move-DatabasePath cmdlet.

          The database and log files for non-replicated databases should be on separate volumes as a best practice.

  27. Matthew Prentice says:

    Paul, Thank you for all the great information on Exchange. I recently discovered the new “feature” of Exchange 2013 CU11 called EMS Anchoring. Now that my EMS session is anchored to a particular server it appears I cannot run Move-DatabasePath on databases unless they are on the server my administrator mailbox is on and I’m running EMS on that server.

    We have a brand new environment with 6 Exch 2013 CU11 servers. Today I went to run the Move-DatabasePath command. I kept getting errors that the command cannot be run for mailbox databases on remote servers. I was on server 01 but my admin mailbox is on server 03. So I logged into server 03 and was able to successfully run the Move-DatabasePath command on a database on server 03. So now how do I successfully run the Move-DatabasePath command on server 01 if I’m proxied to server 03 for all of my EMS sessions? Not sure this was fully thought out. Any guidance is appreciated.

      • Matthew Prentice says:

        Thank you Paul. I had seen Andrew’s article before and it is helpful. I can get the Move-DatabasePath command to work on the local server when I load the snapin. I haven’t found a way to successfully execute the command remotely yet. I either get the error that the command can’t be used on a remote server or I get the “Active Directory operation failed on . The supplied credential for ‘XXXYYY’ is invalid.” error. I’ll keep digging to see what I can get working for remote scripts.

        • Consider that during Exchange setup you can set the name and path of the first database that is created on the server, which avoids this issue.

          And for any requirement later on when the server is in prod, a new database followed by mailbox migrations is less disruptive than moving the path of a database that is in use by end users.

          As for getting this working on remote servers, unless you’re doing this task on a daily basis I wouldn’t spend any time trying to find a better solution. I expect that future CU’s from Microsoft will relieve some of the pain points that the mailbox anchoring change introduced.

  28. alhalfowi says:

    Hi Paul

    Great article However, I ran the command move-databasepath -identity “Mailbox Database 09888363244” -Edbfilepath “e:MailboxD1Mailbox Database 09888363244.edb”
    To move the database to the new path in the same server but difference partition . Was logged into and running the command from my exchange server. However, I get the error:
    The operation couldn’t be performed because object ‘mailbox Database 09888363244’
    + categoryInfo :Notspecified : [Move-DatabasePath]
    + FullyQualifiedErrorld : 55A980E4,Microsoft.Exchange.Management.SystemConfiguration
    + PSComputerName : mail.xyz.com

    ————-
    Could you help me please ….

  29. PK says:

    Hi Paul, I am moving my DB to another drive. DB size is around 50 GB. How much time it will take? From past 2 hours the command is stuck at ‘copying edb file..’ Shall I cancel the operation and move mailboxes instead to other drive.

  30. Mahbod says:

    Thanks for help
    Is there any way to move a database from a server to an other server those are in unique organization but we don’t have DAG?

  31. Ramon says:

    I have a virtual machine wrongly configured for exchange 2013, because the drive c is configured with only 22gb only. it has been working for 2 years now as the mailbox store increased… the exchange went down.

    i tried moving the database to drive d: that has 40 gig free. after successful move, it doesnt mount.

    Maybe i did not move it using command line… i moved it using the path in the properties of mailbox store.

    it has error, IDno: c1041724 when mounting, as i researched MS says free up space in drive, does it mean free up space in drive d or drive c?

    to make it work temporarily… i again moved it back to drive c: it mounted but my outgoing wont work.. it piled up the queue… maybe because the free space in drive c is only 480mb.?

    help me pls…

    thanks

    Ramon

  32. Ahmad Salheen says:

    I want to move database logs folder path only, this database is DAG Memeber
    i tried with Move-DatabasePath -Identity database01 -LogFolderpath X:Folder

    i received the below error:
    Move-DatabasePath is not allowed for replicated databases. For detailed steps to change the location of a replicated.

    Please help me

Leave a Reply

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