Best Way to migrate Data From CPanel to another Cpanel Server

Have you ever needed to rebuild a server from WHM/cPanel backups?
We have – and recently with WHM/cPanel version 11.38, they’ve included system files as well.  These are backed up in the /backup/$DATE/system directory and should have everything you need to make a clone of your current server – settings and all.
Before you run this script, I’d like to tell you that you really should know enough to be able to read through it and see what its doing.  It does three things:
  1. Restores the system directories located in /backup/$DATE/system/dirs/ directory
  2. Restores the system files located in /backup/$DATE/system/files/ directory
  3. Restores all of the accounts in the /backup/$DATE/accounts/ directory
You can comment out any one of these sections in the file if you only want to do 1 or 2 of the 3 functions.
You also want to make sure the target server is running the same version of software that your old server was – especially the main operating system version because file locations may change from version to version.
If you have any questions on the script, please feel free to comment.

Set up the backup

On your old server, you’ll need to have regular backups set up. This is the new ‘backup’ that WHM/cPanel offers, not the Legacy backup.
WHM –> Backup Configuration
Go through the settings and be sure to select ALL users, MySQL backups (Per Account and Entire MySQL Directory), and System Files otherwise you won’t get a full backup.
Hit save at the bottom.
Run the backup by logging into your server via ssh and become root.  Then fire off the backup manually (this may take up resources on  your current server – maybe run it at off-peak hours). Please make sure you have enough room on your server for a full backup! If you do not, configure the server to send the backup to a mounted drive (if you want system files). If system files don’t matter to you, you can set up an ftp additional destination.
Once its done, you can change to the /backup directory (or where ever you told it to backup) and you’ll see a directory with today’s date.
Look through there and make sure you have files in there and that everything looks ok.
Tar up the backup
Next, you’ll want to tar it up and send it to your new server. Change to the /backup directory and tar it up like:
It properly handles directories with spaces in their names.You’ll see all the files shooting by.. and it will create many archives named ‘mybackup.tgz’. I’d recommend using scp to shoot it to your new server. You could also move it into a web-viewable location to easily download it to your home PC (not a bad idea to have an extra copy of it).
(this will drop it into the /home directory on the new server)

Post a Comment

0 Comments