How to merge MailStore archives

If you have recently upgraded to MailStore version 9 you may not be aware that the new maximum number of messages that an archive can contain has now been increased from 500,000 to  5,000,000 messages.

If you are like me and you have found yourself with a collection of much smaller MailStore message archives it is now much easier to merge these together into a smaller number of larger archives.

Let’s Begin

This process can take some time but during the process, any messages that are duplicated across archives will get de-duplicated so you may find that the overall storage required drops.

You can also find that in deployments that have 100’s of archive stores reducing this to 10 or less will dramatically increase archive throughput and will vastly improve users experience.

To merge archives within MailStore we first need to know the Archive ID which we can find in the Storage location window.

(Administrative tools -> Storage -> Storage Locations)

In this example, I am going to merge the top two archives ‘2009-12’ and ‘2010-11’

Management Shell commands

Now we know which archives we wish to merge we need to open the Management Shell (Administrative tools -> Management API > Command Prompt)  and run the command..

MergeStore -id=29 -sourceId=40 

(Please note this command is case sensitive ‘sourceId’)

If you have issues with the above command try..

MergeStore –id=29 –sourceId=40 

In this example, I want to merge message Archive ID 40 into Archive with ID 29. This will copy the message from Archive ID 40 and store them into Archive ID 29, so at the end, we should end up with an Archive with 1,027,103 messages in it.

During the merge, you should see the number of messages that have been completed. Please be aware this will take a long time when dealing with 1000’s of messages!

In my testing, I was seeing about 30 messages a second being merged so 500,000 messages would take about 4.5 hours to merge.

Once finished if we now look at the storage locations you can see Archive store ’29’ now contains all of the messages from Archive store ’40’ and Archive 40 is still attached.

We no longer need the old Archive store 40 and in effect now contains duplicates only, so we can detach this old store using either the following command in the Management Shell window.

DetatchStore 40

…or manually by right-clicking on it and choosing ‘detach’.

So there we have it in its simplest form we have merged two archives.

Don’t forget to delete the source files

Now you have detached the message store you are safe to delete the archive store folder to free up drive space. In our example, the old message store was located in D:\mailarchive and was named ‘2010-11’. Make sure you delete the correct store if in doubt rename it first and make sure you can still see all the archives you are using.

Those of you that have a large number of archives may have noticed that with a little pre-planning it would be possible to script this process to add multiple archive stores together and detach the old ones once that has been done.

I won’t cover this more advanced method in this guide, but if you do have a large number of archive stores you need to merge and you want to automate the process please drop me a comment below.



Share via
Copy link
Powered by Social Snap