skip to Main Content

Move mail queue Exchange 2016 to another location

The mail queue database in Exchange temporarily holds location for messages. These messages are waiting to enter the next stage of processing or delivery to a destination. Move mail queue in Exchange 2016 to another location to prevent the C: drive getting out of disk space. It’s best practice to move transport database mail.que when configuring a new Exchange Server. In this article, you will learn how to move the mail queue in Exchange 2016 to another location. We are going to make use of a PowerShell script to move Exchange transport queue.

Create NTFS partition for the mail queue database

Before we start moving the mail queue database, we are going to:

  • Add a new disk on the Exchange Server.
  • Create and format a new NTFS partition (volume) with an allocation unit size of 64K.
  • Name the volume Queue and give it the drive letter Q.
The required partition for the mail queue database is NTFS.

Get disk status

After adding a disk to the Exchange Server, we are going to configure it for the mail queue database. Run Exchange Management Shell as administrator. Get the information regarding the disks in the system using the Get-Disk cmdlet.

The disk that we like to configure is showing as Number 3 and it’s offline.

PowerShell one-liner creating NTFS volume

The partition style of disk number 3 is showing as RAW. We are going to set the disk online and initialize the partition as GPT (GUID partition table). Mount the partition as drive letter Q with the format volume NTFS and allocation unit size of 64K. We recommend configuring 64K allocation unit size/block size on the transport database volume in Exchange. Read more in the following article. The name of the new volume will be Queue.

The NTFS volume is successfully configured. Verify the disk in Disk Management

Create disk drive before move transport database Exchange

Open File Explorer and go to This PC. Verify that the Queue disk is showing.

Verify disk drive before move transport database Exchange

The volume is created with an NTFS partition and showing in This PC. In the next step, we are going to verify if everything is in place. After that, we will move the transport database to the Queue disk.

Before moving Exchange mail queue database

It’s good to prepare and make sure that we have everything in place before we start moving the mail queue database.

Microsoft created a PowerShell script Move-TransportDatabase.ps1. This script can be used to move the mail queue database to another location. The script is located in the Scripts folder. Find the script in the following path:

Confirm that the Move-TransportDatabase.ps1 is showing in the scripts directory.

Move mail queue Exchange 2016 to another location Move-TransportDatabase.ps1

Start File Explorer and go to the following path:

The Transport Roles folder, including the folders in data, is going to be moved to another location. In our example, the Q drive. Open the Queue folder if you like to check the mail.que database.

Move mail queue Exchange 2016 to another location before running the script

After verifying, we are ready to move the transport database in Exchange Server 2016.

Move Exchange mail queue database

Change the path to the default Exchange scripts folder. Run the command to move the Transport Roles folder including the mail queue database.

The script will do the following:

  1. Calculate the size of the files that are going to be moved.
  2. Check if there is space available on the disk.
  3. Creates new folders with permissions.
  4. Stops the Microsoft Exchange Transport service.
  5. Creates a back-up of the configuration file.
  6. Move the files.
  7. Starts the Microsoft Exchange Transport service.
There will be no mail data loss when using the PowerShell script.
The Transport Roles data folder is moved successfully to the Q drive.

Verify Exchange queue database files after moving

Start File Explorer. Verify the folders in the new location.

Open the Queue folder and verify that the files exist in the new location:

  • Queue database files mail.que and trn.chk.
  • Transaction log files trn.log, trntmp.log, trnres00001.jrs, trnres00002.jrs, and tmp.edb. Even though temp.edb isn’t a transaction log file, it’s kept in the same location as the transaction log files.

Move mail queue Exchange 2016 to another location after running the script queue folder

Good to know about EdgeTransport.exe.config

We can find the values that we have configured in the CONFIG file named EdgeTransport.exe.config. The XML application configuration file is associated with the Exchange Transport service. Find it in the following path:

After running the PowerShell script, the EdgeTransport.exe.config is renamed. The date and .old are appended to the config name. You can open both the .config and .old file with Notepad.

Move mail queue Exchange 2016 to another location EdgeTransport.exe.config

Compare the following keys in both files:

  • QueueDatabasePath
  • QueueDatabaseLoggingPath
  • IPFilterDatabasePath
  • IPFilterDatabaseLoggingPath
  • TemporaryStoragePath

Before moving the database queue database

Move mail queue Exchange 2016 to another location EdgeTransport.exe.config before

After moving the database queue database

Move mail queue Exchange 2016 to another location EdgeTransport.exe.config after

Now that you moved the mail queue database to another location, it will be easier to track. The monitoring team will get a notification that the Queue disk is getting full, knowing immediately that’s the mail queue database.

Did the article help you to move Exchange transport queue to another location?

Conclusion move mail queue Exchange 2016

In this article, you learned how to move mail queue in Exchange 2016 to another location. First, we created a separate disk volume for the queue database. Second, we moved the transport database with the PowerShell script Move-TransportDatabase.ps1. As of last, we verified the moved files in the new location. I recommend using the script by Microsoft to move the exchange transport database queue. Did you enjoy this article? You may also like Exchange 2016 firewall ports for mail flow and clients. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect and IT Consultant. His specialism is designing and building complex enterprise environments. He started Information Technology at a very young age, and his goal is to teach and inspire others. Connect with ALI TAJRAN on social media. Read more »

This Post Has 0 Comments

Leave a Reply

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

Back To Top