Parallels H-Sphere Documentation System Administrator Guide

 

Moving Mail Domains

 
 

Related Docs:   Moving Mail Service

Last modified: 15 May 2007

 

WARNING: This documentation covers Parallels H-Sphere versions up to 3.1. For the latest up-to-date Parallels H-Sphere documentation, please proceed to the official Parallels site.

Moving mail domains in H-Sphere is not fully automated, which means it can be applied to individual domains or small groups of domains. The below procedure doesn't work well with large groups of mail domains or entire resellers.

Please be prepared that due to the propagation of the new IP address, mail domain move can result in up to 24 hour downtime and inability to edit the mail boxes.

To move a group of user domains from one mail server to another:

  1. On the new mail server, log in as root and run the following commands for each domian:
    1. Register a new mail domain:
      ~vpopmail/bin/vadddomain <DOMAIN_NAME> <ANYPASS>
    2. If the domain you are moving has domain aliases, set up each alias by the following command:
      ~vpopmail/bin/vaddaliasdomain <DOMAIN_NAME> <ALIAS_NAME>
    3. Get the location of this domain directory:
      ~vpopmail/bin/vdominfo <DOMAIN_NAME>
    4. Remove the content of this directory:
      rm -rf <DOMAIN_DIRECTORY>
    5. Copy the content of the original maildomain directory from the source server:
      scp -r root@<OLD_SERVER_IP>:<SOURCE_DOMAIN_DIRECTORY> <DOMAIN_DIRECTORY>
    6. Update ownership of the domain directory and its content:
      chown -R vpopmail:vchkpw <DOMAIN_DIRECTORY>
      where:
      <DOMAIN_NAME> is the mail domain
      <ANYPASS> is any string. Later it will be replaced with the real password
      <DOMAIN_DIRECTORY> is the location of the domain directory on the target server
      <SOURCE_DOMAIN_DIRECTORY> is the location of the domain directory on the source server
      <OLD_SERVER_IP> is the IP address of the source mail server.
    7. Restart mail server to apply changes.
  2. If the domain directory path is different on the source and target servers:
    1. Go to the domain directory on the target server and update all mailbox paths in the vpasswd file and all files that have names beginning with .qmail-.
    2. Add and delete a temporary mailbox to apply changes:
      [root@mail3 example.com]# ~vpopmail/bin/vadduser blala@example.com
      Please enter password for blala@example.com:
      enter password again:
      [root@mail3 example.com]# ~vpopmail/bin/vdeluser blala@example.com
  3. On the old mail server, log in as root and delete the domains using this command for each domain:
    ~vpopmail/bin/vdeldomain <DOMAIN_NAME>
  4. Important! Back up the H-Sphere system database.
  5. Log into the system database and run the following queries:
    1. Set new logical server id for each domain name:
      UPDATE mail_services SET mail_server=<NEW_LSERVER_ID> WHERE id=(SELECT child_id FROM parent_child WHERE child_type=1000 AND parent_id=(SELECT id FROM domains WHERE name='<DOMAIN_NAME>'));
    2. Get current values from the MX and CNAME records for the moved domains:
      SELECT r.id, r.name, r.type, r.data, r.ttl, r.pref FROM domains d, parent_child p1, parent_child p2, dns_records r WHERE d.name='<DOMAIN_NAME>' AND d.id = p1.parent_id AND p1.child_type=1000 AND p1.child_id = p2.parent_id AND p2.child_id = r.id AND (p2.child_type=1007 OR p2.child_type=3006);
    3. Update MX and CNAME records with the new values:
      UPDATE dns_records SET data='<TARGET_MAIL_SERVER_NAME>' WHERE id in (<MX_ID>, <CNAME_ID>);
      where <MX_ID> and <CNAME_ID> are the record IDs you got on the previous step.
    4. Restart H-Sphere to apply changes.
  6. As the cpanel user, update your DNS settings using the DNS Creator utility:
    java psoft.hsphere.tools.DNSCreator -m db -dz -z <DOMAIN_NAME>
    where <DOMAIN_NAME> is the domain name you are updating MX and CNAME for.

Related Docs:   Moving Mail Service



© Copyright 2017. Parallels Holdings. All rights reserved.