Move a Domain from one SmarterMail Server to Another

This article applies to recent versions of SmarterMail. View articles for SmarterMail 16.x and earlier.
On occasion, system administrators may need to move a domain from one SmarterMail server to another. For example, there's a domain that is using an inordinate amount of disk space, so it needs to be moved to a SmarterMail server that has a lot of free disk space available.

Using Attach / Detach
The simplest way to move a domain, and one that does NOT entail stopping the SmarterMail service (thereby stopping email for all domains on the server) is to use Detach / Attach. NOTE: if you attempt to Detach a domain that is on an older version of SmarterMail -- one that still has XML files, for example, rather than one that has been converted to JSON -- this will fail. You will need to follow the steps outlined in Manually Moving a Domain. 

To use Detach / Reattach, do the following (NOTE: You do NOT need to stop the mail service on either server when detaching/attaching domains):
  1. Log in as the System Administrator.
  2. Navigate to Manage -> Domains.
  3. Select the domain you want to move. 
  4. Select Detach Domain, either from the Actions (⋮) menu or by right clicking the domain name and selecting it from the context menu.
  5. Go to the Domains folder in your SmarterMail installation (Windows Default: C:\Smartermail\Domains  |  Linux Default: /var/lib/smartermail/Domains).
  6. Copy the folder of the domain you want to move. If moving the domain to a non-networked server, you will want to copy the folder to an external drive.
  7. Once the domain's folder is copied to the new server, you'll want to log in to SmarterMail on that server as the System Administrator.
  8. Again, navigate to Manage -> Domains.
  9. Select Attach Domain from the Actions (⋮) menu.
  10. Type in the path to the new domain folder you moved over. By default, this will be DomainPath\DomainName.
  11. Click the Attach button.
  12. Finally, retrieve the domain's SSL certificates from the old Certificates directory, and move them to the destination server's Certificates directory (Windows Default: C:\Smartermail\Certificates  |  Linux Default: /var/lib/smartermail/Certificates).
It's worth noting that all users, settings, notes, calendars, tasks, etc. are all moved when you use Detach / Attach. The only thing impacted is domain aliases. Those will need to be re-created once the domain is moved.

Manually Moving a Domain
Follow these steps to manually move a SmarterMail domain to another server. NOTE: These are the instructions to use if you're on an older version of SmarterMail that still uses XML files:

  1. Before beginning, make a backup copy of the domains.json file (Windows Default: C:\Program Files (x86)\SmarterTools\SmarterMail\Service\Settings\ |  Linux Default: /etc/smartermail/) and the folder for the domain you want to move. So if you were moving example.com to a new SmarterMail server you'd want to make a backup of DomainPath\example.com. (Windows Default: C:\Smartermail\Domains  |  Linux Default: /var/lib/smartermail/Domains).
  2. Stop the SmarterMail service on both servers.
  3. Copy the domain's folder from the old server to the new server. The default install path for the domain folder should match the old server (DomainPath\example.com).
  4. Using Notepad or a similar text editor, open the domains.json file on the old server. 
  5. Locate the entry for the domain being moved. (E.g., example.com) It will be displayed in one of these two formats:
    "example.com": { "data_path": "C:\\Smartermail\\Domains\\example.com" },
    
    // or, for Linux:
    
    "example.com": { "data_path": "/var/lib/smartermail/Domains/example.com" },        
  6. Copy the domain entry from the file and keep it on hand. Then delete the domain entry and save the file. (NOTE: You may need to save it to the desktop, then manually replace the original due to Windows Security.)
  7. Make a backup of the domains.json file on the new server.
  8. Using Notepad or similar text editor, open domains.json on the new server.
  9. Paste the domain entry from the file on the old server, making sure to adhere to the proper naming/formatting of the name.
  10. Save the file. (NOTE: You may need to save it to the desktop, then manually replace the original due to Windows Security.) 
  11. Start the SmarterMail service on both servers.
  12. Update the primary MX record for the domain to the new IP. This can take up to 24-48 hours for propagation.
  13. Finally, retrieve the domain's SSL certificates from the old Certificates directory, and move them to the destination server's Certificates directory. (Windows Default: C:\Smartermail\Certificates  |  Linux Default: /var/lib/smartermail/Certificates).
 
Learn more about using SmarterMail for your email accounts and company-wide chat.

Feedback

How do this for version 8 and older? Where the directory structure of the users mailbox is different?

I believe in version 9 and newer, you guys put the mailboxes under a "mail" directory, e.g. c:\smartermail\domains\abc.com\users\joe\mail.

How do I move the domains from version 8 and older to 9 and above in this case?

ilyas (3/25/2014 at 12:21 PM)
You can still follow the same steps for older versions. The file structure that were change is below the domain level and when you move a domain that does not have the correct file structure on start up SmarterMail will automatically correct it.
Brian Ward (3/25/2014 at 12:48 PM)
Well I just did a test of one domain from an older version of SmarterMail to 13.x and while the users moved, the mail and folders do not appear in the web interface. So Brian, I don't think you're correct. Now I'm not sure how I'm supposed to migrate over 500 users and 65 domains.
John Draper (11/5/2014 at 5:07 PM)
I see Rod did reply back to your community post here: http://portal.smartertools.com/community/a738/migration-issue.aspx
Brian Ward (11/6/2014 at 9:03 AM)
Hi, my server is running SM v4.3. I'm migrating to SM v12. Is it possible to migrate the domain list and all the domain user accounts? Just the domain and user entries. I don't mind about the email messages. Thanks
Mostafa Helal (12/11/2014 at 9:08 AM)
Hi Mostafa,

It is possible to migrate just the domain list and user accounts. However, this is a tedious process and it's not one that we recommend. Essentially, you'd have to strip out all of the .grp files and any other files such as calendars, contacts, etc. if you do not want to bring them over with the accounts. Is there a specific reason you only want the list and accounts? If it was just to make the process simpler, it would probably be easier to migrate the user accounts as a whole.

Andrea Free (12/11/2014 at 2:19 PM)
Hi, I have a server with version 13.3 Enterprise containing 300 domains and 2000 users and is 700 GB.
I need to migrate to a larger server but I can migrate only a few domains each night.
The old and the new server will have different IP and different FQDN (for example: mail.domain.com and mail2.domain.com ) .
Can I use my license without problems on both servers simultaneously for 30 days?

Gonzalo Varela Rua (4/11/2015 at 12:58 AM)
You can! We allow licenses to be on multiple servers for up to 30 days for migration purposes.
Andrea Free (4/12/2015 at 12:08 PM)