Skip to content

DNS migration runbook — cPanel to cPanel without losing records

Moving DNS authority from one cPanel host to another has more failure modes than copying zones. Here is the runbook that gets the zones, NS, and registrar in step.

A customer migrates from an aging cPanel host at one provider to a fresh cPanel host at another. The web content and mail moved over WHM Transfer Tool. The DNS zones moved too. Two days later, the customer reports that several SaaS verifications and a Google Workspace site verification disappeared. The Transfer Tool didn’t lose them — but the nameserver change at the registrar happened before the zones finished syncing, and the new authoritative server returned empty zones for a few hours.

What’s happening

A DNS migration between two cPanel hosts involves three independent moving parts:

  • Zone content on the source host (what records are in /var/named/*.db).
  • Zone content on the destination host (after import).
  • NS records at the registrar (which tells the world which hosts are authoritative).

The classical failure is to flip the NS at the registrar before the destination has every zone fully populated. During that window, half the world queries the new (empty) nameservers and gets NXDOMAIN. Cached negative answers make the recovery longer than expected.

The right order:

  1. Pre-stage the destination with every zone, identical to the source.
  2. Lower TTLs on the NS records (and possibly the zones’ SOA min-TTL) days in advance.
  3. Verify the destination serves every zone exactly as the source does.
  4. Update NS at the registrar.
  5. Watch for traffic on the destination, decay on the source.
  6. After 72 hours, decommission the source.

How to verify

Pre-migration audit — capture every zone on the source:

whmapi1 list_zones
ls /var/named/*.db | wc -l
for zone in $(whmapi1 list_zones --output=jsonpretty | jq -r '.data.zone[]'); do
  whmapi1 dumpzone domain=$zone > /tmp/source-zones/$zone.txt
done

During the migration, compare destination to source:

diff <(ssh source 'whmapi1 dumpzone domain=example.com') \
     <(ssh dest   'whmapi1 dumpzone domain=example.com')

After the NS change:

dig +short NS example.com @a.gtld-servers.net
dig +short example.com @new-ns1.example.com
dig +short example.com @new-ns2.example.com

The first confirms the TLD knows about the new nameservers. The second and third confirm the new nameservers actually answer.

What to do

  1. Inventory every zone on the source. whmapi1 list_zones plus a backup of /var/named/. Include zones for parked and addon domains — the Transfer Tool sometimes misses these.
  2. Lower TTLs to 300 on the records most likely to be queried (apex A, www A, MX, NS) at least 24 hours before the cutover. Lower the SOA minimum TTL too — that affects how long NXDOMAIN gets cached if the destination has a brief gap.
  3. Migrate accounts with WHM Transfer Tool. WHM > Transfers > Copy or Restore a cPanel Account. Include DNS-only domains separately if any aren’t tied to a cPanel account.
  4. Verify each zone byte-for-byte between source and destination using the diff above. Differences are usually whitespace or comments and harmless; if you see missing records, fix them.
  5. Test the destination by pointing your laptop’s resolver at the new nameservers (/etc/resolv.conf or via dig @new-ns1.example.com). Spot-check the web and mail for each zone.
  6. Update the registrar. Change NS records to the destination’s nameservers.
  7. Keep the source nameservers running for at least 72 hours after the change. They should serve identical content to the destination during this window — otherwise resolvers cached on the source will see stale data.
  8. Watch query rate on both nameservers during the transition. rndc stats or tail /var/log/messages | grep named-stats shows query rates. The source should decay to near zero over the TTL window; the destination should grow.
  9. After 72 hours, decommission the source. Remove its NS records from the zones, remove the source from any DNS clusters, and reclaim the IP.

If the migration involves a registrar change at the same time as the NS change, handle them in separate steps with at least 48 hours between. Two concurrent changes share blame when something breaks.

Stack Harbor runs cPanel-to-cPanel DNS migrations in coordination with web and mail in migration solutions.