Symptom: Large mail.que file size
Last week my Icinga started alerting about low free space in my Exchange server disk.
After using a software to scan for file sizes I realized there was a too big mail.que file.
This is the file in which exchange manages its queues before finally delivering emails. It is usually located in <Exchange_Installation_Path>/TransportRoles/data/Queue
Solution: Rebuild queue files
Like the EDB mailbox databases, the queue file generates white space that can only be recovered by rebuilding it. After performing the following procedure, the extra space mail.que file is using will be recovered:
Check queues
Run this powershell command to ensure there are no queued messages
[PS] C:\> Get-Queue | select-object Identity,MessageCount
Identity MessageCount
-------- ------------
EXCHSRV1\4 0
EXCHSRV1\5 0
EXCHSRV1\6 0
EXCHSRV1\7 0
EXCHSRV1\8 0
...
In case any queue has messages, “pause” the “Microsoft Exchange Transport” service and wait for them to empty:
Stop Transport service
After ensuring the queues are empty, simply stop the “Microsoft Exchange Transport” service
Move Queue files
Move the contents of the “<Exchange_Installation_Path>/TransportRoles/data/Queue” folder to another path. If you are in a critical situation (out of space), you can move them to another disk.
For example, I created a Queue.BAK folder in which I placed the files
Start Transport service
You can check the queue folder before (should be logically empty)…
…starting the “Microsoft Exchange Transport” service…
and afterwards, recheck it (regenerated files).
Note the small size of the newly created mail.que file.
Final tests
After performing some mail flowing tests (for example send and receive new emails, check the modified date of the queue files is changing…) and if everything went ok, the old files can be safely deleted. Just in case you can wait a reasonable time to do it. Sysadmins always should have a plan B. 😉