How do I revert the changes made by cPanel live transfer? If you are a system administrator in the web hosting industry, I’m pretty sure you’ve heard of cPanel Live Transfer. Or maybe you manage on your own your dedicated server with cPanel, and you are at a point when you must migrate your data to a different server, and this is who you heard about cPanel Live Transfer. First, however, what is cPanel Live Transfer?
The Live Transfer takes the Transfer Tool to the next level by allowing you to altogether avoid downtime during the migration. If both the source and destination machines are running cPanel using version 90 or higher the Live Transfer tool edits the Source machine to route traffic to the Destination server immediately once the data migration is complete. You can read the technical explanation on cPanel official documentation website.
Alright, that’s a pretty cool feature, but what if I want to abort the migration? How can I roll back the transfer? This might be needed, and let me tell you a little story.
A few weeks ago, I had to migrate 3 websites from an old cPanel server to a new cPanel server. That sounds like easy peasy, but during the Live Transfer, a few databases failed to migrate because the old server was running on MySQL 5.7, and the new machine was running on MariaDB. I’ve spent a couple of hours trying to convert the tables and make them compatible, but without success or guaranteeing that no data will be lost during the conversions. Long story short, I had to abandon the idea of the migration, roll back the LiveTransfer and check with my colleagues to find a solution for this situation.
Voila! This is how I ended up trying to roll back a LiveTransfer process, and I’m writing this article because I hope other people will read it and not spend so much time as I did.
Live Transfers result in the suspending of accounts on the source server, services are proxied to the destination server, MX is redirected to the destination server, and DNS is also updated to the destination server.
To revert the changes made by Live Transfer, perform the following steps on the source server:
1. Unsuspend the account.
2. Manually unset the service proxies using the unset_all_service_proxy_backends WHM API call:
whmapi1 unset_all_service_proxy_backends username=$USER
3. Remove the dynamic content blocks in .htaccess with the following command:
/scripts/xfertool --unblockdynamiccontent $username
4. Remove the manual MX redirects that the Live Transfer option created. Run this command for every domain that used the Live Transfer option:
whmapi1 unset_manual_mx_redirects domain=domain.tld
5. Update the DNS records to point back to the source server. Point the A records for any proxied accounts to the source server.
To unset service proxies for all accounts on the server, run this command:
cut -d":" -f1 /etc/trueuserowners | while read user;do whmapi1 unset_all_service_proxy_backends username=$user;done
To unset all domains that are having mail rerouted to a destination server, run the following command:
cut -f1 -d":" /etc/manualmx | while read domain;do echo; echo "Unsetting ManualMX for $domain";echo;whmapi1 unset_manual_mx_redirects domain=$domain;done
While you might say that’s all, well is not 🙂 as the last step, go to cPanel for each of the affected accounts and make sure their e-mail routing is set to local/remote as per your needs.
That should be all and I hope I was able to help you out. But again, do not hesitate to comment on this article if you have questions, ideas, or suggestions!
2 replies on “How do I revert the changes made by cPanel live transfer”
hey dude, thank you so much for this article, I’ve spend hours until I found this.. thank a million for real
You welcome James, I feel you, it happened to me as well. Glad I was able to help you out!