However, account restore can often generate permission errors, file format problems and many more.
1. Taking cPanel backup
From the cPanel, the user just has to navigate to the Backup option to get the account backup.
Additionally, cPanel has options to download Database, Home directory backups alone too.
2. Copy to the new server
We now have the backup files available. As the next step, we need to copy the files to the new server. By default, we use scp command to bring the files over. The exact command will be
scp /home/cpmove-user.tar.gz firstname.lastname@example.org:/home
Here, x.x.x.x denotes the IP address of the new server.
When there are multiple accounts to copy we usually use a script to generate backup and copy them over to the new server. Again, we do this in batches to have better trackability.
3. Restore backup on the new server
This involves restoring the website contents, databases, emails, etc. We’ll now see how our Migration Engineers restore each of them.
Restoring Web contents
The very first process in restoring the website is the copying of the web content. For this, we extract the cPanel backup file of the account. Then, there will be a homedir directory within the cpmove archive that holds the website contents. We copy the content of the public_html folder on to the website root directory of the new domain.
For example, when the website root directory of the domain on the new server is /var/www/html/mydomain.com, we copy the files using:
cp -rpf homedir/public_html /var/www/html/mydomain.com
Most websites work with databases. Therefore, the next step is to import the databases over to the new server.
Here, we locate the MySQL files, database.sql and restore that file to the database using the below command.
mysql -u username -p databasename < database.sql
Also, we create a database user and grant permission too.
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';
We repeat the process for all databases and make sure that database users have adequate privileges too.
For instance, when the source and destination servers have mails in Maildir format, we just need to copy the mail folders.
Here, we find mail folders from the backup at at
We create the email accounts in the new server and copy the content from the old email folder to the new one.
Common errors with backup restore
Though the migration appears pretty straight forward, customers end up in errors while following it. Let’s take a quick look at how our Migration Specialists correct them.
1. Corrupted backup file
In many cases, the corrupted backup files create problems while restoring.
tar: Exiting with failure status due to previous errors
This error primarily happens with the command-line backup generation. This means, for any reason, tar can’t add all of the specified files to the tar. One of the most common is not having read permission on one of the files.
In such cases, we identify the problem directory or file and exclude that from the tar backup. For example, to take a tar file excluding the sys, tmp folder, the command would be:
tar -cpzf /backups/domainbkp.tar.gz --exclude=tmp --exclude=sys
By excluding these directories, backup restore works just fine.
Again, when the user does not have permission to write the files in the archive also attributes to such errors. The easiest fix is to do the restore as the superuser root.
2. Incorrect privileges
Incorrect privileges is yet another common reason for errors when restoring cPanel backup on the new server. This can be on the files and folders or even with the database.
In such a scenario, our Migration Engineers set proper permissions on the files and folders to the site user.
Again, in the case of MySQL databases, we add the users to the proper databases.
[Trouble when restoring cPanel backup on new server? We can help you migrate the account]
In short, manual account migrations can be challenging. Improper migrations can result in website downtime and errors. Today, we saw the exact procedure on how to restore cPanel backup on new server. Our Migration Specialists do proper planning to avoid potential migration errors.