How to Move an Exchange 2010 Database to a Different Folder

When an Exchange Server 2010 Mailbox server is installed there is a mailbox database added to the server as part of setup.

The default location for the database is in the \Mailbox folder of the Exchange 2010 installation directory. For example:

C:\Program Files\Microsoft\Exchange Server\V14\Mailbox\Mailbox Database

One of the first actions you will normally take is to move the database and transaction log files to a different folder. You can do this with the Exchange Management Console or via command line using the Exchange Management Shell. This is a quick and easy task when the database is brand new and doesn’t contain a lot of mailboxes or data.

Moving an Exchange 2010 Mailbox Database with the Exchange Management Console

Launch the Exchange Management Console and navigate to Organization Configuration/Mailbox. In the Database Management tab, right-click the mailbox database that you want to move, and choose Move Database Path.

Enter the new paths for the database and log files, and then click Move.

The database will be dismounted before it can be moved, which you will need to accept first.

The move will take some time depending on the size of the database and transaction log files being moved.

Moving an Exchange 2010 Mailbox Database with the Exchange Management Shell

To achieve the same mailbox database move as above but using the Exchange Management Shell you would run the following command:

Move-DatabasePath -Identity 'MB-HO-03' -EdbFilePath 'E:\Data\MB-HO-03\MB-HO-03.edb' -LogFolderPath 'D:\Data\MB-HO-03'

As with the graphical wizard you will need to confirm the request before the database is dismounted and moved.

Confirm
Are you sure you want to perform this action?
Moving database path "MB-HO-03".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [?] Help (default is "Y"):
About Paul Cunningham

Paul is a Microsoft Exchange Server MVP and publisher of Exchange Server Pro. He also holds several Microsoft certifications including for Exchange Server 2007, 2010 and 2013. Connect with Paul on Twitter and Google+.

Comments

  1. burntpepsi says:

    can you cancel a move database path in exchange 2007. at the current progress is appear it might take days to complete.

    • I’ve never tried it to be honest.

      • burntpepsi says:

        I ended up shutting down the Exchange server and when it came back up the database mounted in the original location just fine. Looking for a much faster way to move the database path now. I wouldn’t suggest to anyone hardbooting your Exchange server during the database move, I’m just glad it worked. There has to be a much faster way to move your database path, through the console it appeared it might take 24 hours or more, who can afford that much downtime? I do however appreciate your article Paul.

      • The time the move takes will depend on things like how big the database is and how fast the disks are that you’re move from/to.

        If that is taking too long then maybe set up a new database on the new disks and move your mailboxes in batches.

      • burntpepsi says:

        I found a quick way to move my database with only about 10 seconds of downtime. I had LCR enabled so I went ahead and told Exchange to switch to that database. Only had to dismount the database for about 10 seconds while the switchover was running. Worked like a charm! Thanks Paul

  2. Dave Purscell says:

    What is the proper way to accomplish the Database move to a Different Folder when the server is member of a DAG?

    We have four databases in the organization (each with their DAG copies on other servers). Due to growth of two of the databases, I need to move one of the databases to a different volume. The source and destination volumes already exist on both Exchange Servers.

    • You would need to dismount the database, manually move the files on each server, and then use Move-DatabasePath with the -ConfigurationOnly parameter to update the configuration, before remounting the database again.

      This means an outage, so the better way would be to create a new database in the new location and perform mailbox moves from the old database to the new one.

      • Dave Purscell says:

        Thank you for the great suggestions. The problem with performing a lot of mailbox moves is that huge amount of replication that will naturally occur. It would be like ingesting large amounts of fresh data into a DFSR share — the primary difference being that I can throttle the bandwidth for the DFSR replication.

      • Then I guess the brief outage is more attractive :-)

      • As usual, my goto site for everything Exchange 2010, you have answered yet another question I had. I too had to move the logfolderpath for a mailbox database that is a member of a DAG. In my experience, I found that after I dismounted the database, I had to suspend both the copy and the LAG copy. Then move all the log files to the the new folder then remount the database and restart the copy and LAG copy. The LAG copy complained of need to reseed so I just let it go and resync. Of course, all of this after a backup…
        Thanks again for your site.

  3. Aaron Copeland says:

    I have an Exchange server 2010 SP1 running in hosted mode. Will moving the store be any different? I do not have the MMC so I will do it via PS but was curious if you know of any issues or references as to possible different senerios when using the /hosting switch with exchange.

    My database and logs are actually located in this Directory:
    C:\Program Files\Microsoft\Exchange Server\V14\Mailbox\Mailbox Database 0849706585\

    Any help is appreciated!! Thanks

    • Dave Purscell says:

      Eeeewe… Your host actually puts the database and logs on the O/S partition? Time to get a new host. :)

      How big are the files?

      • Aaron Copeland says:

        It was my first attempt at building a hosted exchange server and it is now in production. I need to either move the mail store or expand the root partition to accommodate for the growth. I’d rather move it. I would think it would move fine but with it being in hosted mode I am unsure. The store is only 11 GB. Not to large yet…..

  4. Dave Purscell says:

    If it is that small, it should move easily and quickly.

    Sorry to pick on you. But if you have ever re-installed a server O/S, you understand why data belongs on another drive.

    • Aaron Copeland says:

      LOL… I do know and I NEVER but my data on the root drive. This was a VM and was supposed to be for a test only… My company put it into production and I wasn’t even finished with it.

      So the Move should be like any other move and there is nothing unique about the /hosting mode?? I really appreciate the response and help!!

  5. Faisal Khan says:

    Hi Paul, Thanks, this is another nice article as usual we expect from you. My qestion here is does such move gives you white space back?
    Faisal Khan

  6. Casey Maines says:

    I don’t have the option of “Move Database Path”. Running Ex2010 SP1. 2 servers in a DAG and 4 mailbox db’s. Am I missing something?

  7. Johnny Holston says:

    Hi Paul,
    Trying to move a PF database and logs, but keep getting the following error:
    Failed to connect to target server “Server2″. Error: WMI exception occurred on server ‘Server2.domain.org’: Call cancelled

    Exchange Management Shell command attempted:
    move-DatabasePath -Identity ‘PF2′ -EdbFilePath ‘X:\Mailbox\PF2\PF2.edb’ -LogFolderPath ‘X:\Mailbox\PF2′

    Elapsed Time: 00:15:06

    Searched the Internet, but have not found any real solution. Both the source and destination disk has over 500GB of free space and the PF database and logs are about 140 GB currently. Was hoping that you might have some insight on moving the PF database and logs.
    Any help is appreciated at this point…

    • You’re running that on the server that hosts the PF database, server2?

      Tried doing the same via the GUI?

      • Johnny Holston says:

        Yes, i was on the server that is hosting the PF database. I also tried from the EMC and i still get the same error. I followed the information on the link that you posted, so i am really confused as to why i am getting this error.

        • There is a process you can follow that involves manually moving the files. Basically you would:

          1) Dismount the database
          2) Manually move logs and/or database files to the new path
          3) Run the Move-DatabasePath cmdlet as shown in the article but with the -ConfigurationOnly parameter, which instructs it to only update the attributes in AD

          http://technet.microsoft.com/en-us/library/bb124742.aspx

          4) Mount the database again (possibly waiting a short time first to allow the AD change to replicate)

  8. Ian Cortez says:

    Hi Paul,

    Would a drag and drop of the database folder in exchange 2010 in another folder can? One of my database(.edb) has been moved to another folder, i’m still looking at the exchange shell log for (move-databasepath) command but no to avail base on the time stamp indicated on the file “date modified”.

    Tnx in advance.

    Ian

    • You’re asking if someone can just drag and drop the database file to a different path?

      Possibly. I wouldn’t expect it to work if the database was mounted at the time as there should be a lock on the file by the information store service.

      • Ian Cortez says:

        possibly, but that would dismount the database right? How can i check if the database has been dismounted during that time? i cant seem to find any logs why it has been moved. Still lucky that database still working.

  9. Ian Cortez says:

    i have 4 mailbox server in 1 dag, mbx1 replicate mbx2, mbx3 replicate mbx4. databse1 mounted on mbx3. check all exchange management shell logs via event viewer but no to avail during the (.edb) file was modified (moved to another folder). It was actually moved into another database folder (database2). database2 now has 2 .edb file.

    • Run Get-MailboxDatabase for that database. Look at the EDBFilePath. If the file is in a different path, then you’ve got a problem.

      Run Get-MailboxDatabaseCopyStatus for that database. If the passive database copies where the file is in the wrong path are failed or otherwise not healthy then you’ve got a problem.

      If it looks to you like someone has moved the passive database copies into a different folder then you will need to reseed those database copies so that they are back in the correct folder and up to date as far as replication is concerned. You can likely then remove the databases files that are in the wrong place.

  10. Ian Cortez says:

    [PS] C:\Windows\system32>Get-MailboxDatabaseCopyStatus -Server mbx03

    Name Status CopyQueue ReplayQueue LastInspectedLogTime ContentIndex
    Length Length State
    —- —— ——— ———– ——————– ————
    MBDatabase07\MBX03 Mounted 0 0 Healthy
    MBDatabase-DSL02\MBX03 Mounted 0 0 Healthy
    MBDatabase04\MBX03 Mounted 0 0 Healthy
    MBDatabase06\MBX03 Mounted 0 0 Healthy
    MBDatabase05\MBX03 Mounted 0 0 Healthy
    Hitachi-New\MBX03 Mounted 0 0 Healthy

    [PS] C:\Windows\system32>Get-MailboxDatabaseCopyStatus -Server mbx04

    Name Status CopyQueue ReplayQueue LastInspectedLogTime ContentIndex
    Length Length State
    —- —— ——— ———– ——————– ————
    MBDatabase07\MBX04 Healthy 0 1 4/23/2013 9:08:00 AM Healthy
    MBDatabase-DSL02\MBX04 Healthy 0 1 4/23/2013 9:08:06 AM Healthy
    MBDatabase04\MBX04 Healthy 0 0 4/23/2013 9:07:38 AM Healthy
    MBDatabase06\MBX04 Healthy 0 1 4/23/2013 9:08:05 AM Healthy
    MBDatabase05\MBX04 Healthy 0 0 4/23/2013 9:07:42 AM Healthy
    Hitachi-New\MBX04 Healthy 0 0 4/23/2013 9:06:43 AM Healthy

    [PS] C:\Windows\system32>Get-MailboxDatabase -Identity MBDatabase06 |fl EdbFilePath

    EdbFilePath : F:\MBDatabase05\MBDatabase06.edb

    [PS] C:\Windows\system32>Get-MailboxDatabase -Identity MBDatabase05 |fl EdbFilePath

    EdbFilePath : F:\MBDatabase05\MBDatabase05.edb

    —–before, MBDatabase06 was located at “F:\MBDatabase06″ folder. Do i have to move it to its original location or so be it?

    • Well if it is healthy, mounted, and replicating fine then it didn’t get there by simple drag and drop. I would say someone made a typo when it was created, or deliberately moved it.

      You can move it if you want to. I wouldn’t say you *have* to. But for the sake of neatness and consistency its probably something you’ll want to sort out.

      • Ian Cortez says:

        tanks a lot..! i’ll leave it like that for now. Do you have any idea how can i check via Ex Mgnt Shell or logs why this happens. We are using only 1 admin account and there’s 3 of us here, just want to look up who did this.

        • You could search the admin audit log.

          http://technet.microsoft.com/en-us/library/ff459262(v=exchg.141).aspx

          Keep in mind though that the process for moving a database path for a replicated DB in a DAG is not quite the same as demonstrated above. The DB needs to be manually dismounted, the Move-DatabasePath cmdlet run with the -ConfigurationOnly switch, and the files manually moved, then the DB can be remounted. So it is not likely to be something that was done accidentally.

  11. Ian Cortez says:

    noted sir. Many tnx…

  12. I have a DAG, 5 MB DB on each of 2 MB servers, and simply need to move the log files (NOT the databases) – what is the safest way to do this?

  13. Ian Cortez says:

    oh im sorry , did not include that..yes it will dismount your db. my deepest apologies..

    ian

Leave a Comment

*

We are an Authorized DigiCert™ SSL Partner.
Loading...

Still running Exchange 2003? Time to get moving and start your upgrade. Find out how - Click Here