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:
- On the new mail server, log in as root and run the following commands for each domian:
- Register a new mail domain:
~vpopmail/bin/vadddomain <DOMAIN_NAME> <ANYPASS>
- If the domain you are moving has domain aliases, set up each alias by the following command:
~vpopmail/bin/vaddaliasdomain <DOMAIN_NAME> <ALIAS_NAME>
- Get the location of this domain directory:
- Remove the content of this directory:
rm -rf <DOMAIN_DIRECTORY>
- Copy the content of the original maildomain directory from the source server:
scp -r root@<OLD_SERVER_IP>:<SOURCE_DOMAIN_DIRECTORY> <DOMAIN_DIRECTORY>
- Update ownership of the domain directory and its content:
chown -R vpopmail:vchkpw <DOMAIN_DIRECTORY>
<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.
- Restart mail server to apply changes.
- If the domain directory path is different on the source and target servers:
- 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-.
- Add and delete a temporary mailbox to apply changes:
[root@mail3 example.com]# ~vpopmail/bin/vadduser email@example.com
Please enter password for firstname.lastname@example.org:
enter password again:
[root@mail3 example.com]# ~vpopmail/bin/vdeluser email@example.com
- On the old mail server, log in as root and delete the domains using this command for each domain:
- Important! Back up the H-Sphere system database.
- Log into the system database and run the following queries:
- 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>'));
- 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);
- 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.
- Restart H-Sphere to apply changes.
- 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.