CPanel Local Data Transfer

From SuperbHosting.net Support Wiki

Jump to: navigation, search

This script assumes one thing: that the old CPanel/WHM root partition is mounted on /oldHD (and any second-level filesystems like /var or /home that were separate partitions are mounted under /oldHD/var and /oldHD/home respectively, for example).

To use this script, login as root and simply copy/paste the following code block:

cd /root
cat > cpanel_migrate << "EOF"
#!/bin/bash

#cpanel data migration script
/usr/bin/rsync -avH /oldHD/usr/local/apache/conf /usr/local/apache
/usr/bin/rsync -avH /oldHD/var/named /var
/usr/bin/rsync -avH /oldHD/home/* /home
/usr/bin/rsync -avH /oldHD/usr/local/cpanel /usr/local
/usr/bin/rsync -avH /oldHD/var/lib/mysql /var/lib
/usr/bin/rsync -avH /oldHD/var/cpanel /var
/usr/bin/rsync -avH /oldHD/usr/share/ssl /usr/share
/usr/bin/rsync -avH /oldHD/var/ssl /var
/usr/bin/rsync -avH /oldHD/usr/local/cpanel/3rdparty/mailman /usr/local/cpanel/3rdparty
/usr/bin/rsync -avH /oldHD/var/log/bandwidth /var/log
/usr/bin/rsync -avH /oldHD/usr/local/frontpage /usr/local
/usr/bin/rsync -avH /oldHD/var/spool/cron /var/spool
/usr/bin/rsync -avH /oldHD/root/.my.cnf /root
/usr/bin/rsync -avH /oldHD/etc/httpd/conf/httpd.conf /etc/httpd/conf
cd /oldHD/etc
/usr/bin/rsync -avH secondarymx domainalias valiases vfilters exim* proftpd* pure-ftpd* passwd* group* *domain* *named* wwwacct.conf cpupdate.conf quota.conf shadow* *rndc* ips* ipaddrpool* ssl hosts /etc

#cpanel heal scripts
/scripts/eximup --force
/scripts/fixeverything
/scripts/fixcommonproblems
/scripts/upcp --force

#restart cpanel services
/etc/init.d/cpanel restart

Then, run the script:

chmod 755 cpanel_migrate && ./cpanel_migrate

The script will take anywhere from 30 minutes to several hours to run depending on the amount of data involved. Also, the rsync program has the ability to stop during a file synchronization and pick up where it left off, so feel free to halt the script in the middle if you need to or want to take a closer look at any of the output and start it again.

Personal tools