Sometimes, you might need to restore your cPanel incremental backups onto a different server. For example, this could be due to a server migration or testing a backup recovery plan. This guide will walk you through the process of doing so using SSH access.
- SSH access to both the backup server and the new server.
- The cPanel incremental backup directory on the backup server.
- A cPanel account on the new server.
Steps to Restore cPanel Incremental Backup
1. Transfer Backup Directory to New Server
The first step is to move your backup directory from the backup server to the new server. The backup directory should ideally be placed in the
/home directory of the new server. You can use a variety of methods to do this, such as
scp. Here's an example command for
rsync -avz /path/to/backup/directory root@new-server-ip:/home/
/path/to/backup/directory with the path of your backup directory and
new-server-ip with the IP address of your new server.
2. Create a cPanel Account
Once you have transferred the backup directory to the new server, connect to the new server via SSH. Here, you'll need to create a cPanel account that matches the one from the backup. This can be done through WHM (Web Host Manager) or via the command line with the
scripts/createacct script. Here's how you can do it from the command line:
This command creates a new cPanel account, and it requires several arguments like the domain, user, and password at minimum.
/scripts/createacct example.com username password
username with the username of your actual cPanel account.
3. Restore the Backup
After the account is created, you're ready to restore the backup. Use the
/scripts/restorepkg script, which can restore accounts from the backup directory. Here's the command:
If you want to proceed with the restoration without creating a new account, you can use the
--skipaccount option, which skips account creation during the restoration process.
/usr/local/cpanel/bin/restorepkg --skipaccount /home/username
username with your actual cPanel username.
That's it! You've successfully restored a cPanel incremental backup onto a new server. This can be a very handy operation in certain situations, but it's important to remember that it should be carried out carefully. If you encounter any issues during the process, be sure to reach out to a server administrator or your hosting provider's support team for help.