cPanel rsync backup – How to make it work

Table of Contents

Do you have disk storage problems on the server? Or, is the server backup eating up more disk space?

Moving backup to another location would be the quickest possible solution here.

Luckily, cPanel rsync backup option helps to save disk space by placing backup data to a remote server.

That’s why, at 1 onlyhost, we often get requests from our customers to set up rsync backup in WHM/cPanel as part of our Server Migration Services.

Today, we’ll see how our Migration Engineers set up cPanel rsync backup and fix the related errors.

 

 

What is Rsync?

Rsync is a command that is used to copy data, make backups, and migrate hosts. More clearly, with the help of rsync, we can efficiently transfer and synchronize files between the servers. It’s even possible to copy data to an external hard drive and across networks.

Moreover, rsync uses compression during data transfer. Thus, it offer benefits in time as well as bandwidth.

Fortunately, there are multiple ways to make use of rsync to take a cPanel server backup. Let’s see the top methods that our Specialist Engineers use.

 

1. How we rsync via backup script

1. To backup with rsync, we install rsync utility on to the servers and set up a password less key based authentication for ssh.

2. When we’re done setting up rsync and ssh keys, we create custom script at /scripts/postcpbackup

vi /scripts/postcpbackup

3. Then we add the following code that contains the exact rsync command.

#!/bin/sh

/usr/bin/rsync -va --progress --delete --rsh='ssh -p22' /backupdirect remoteuser@IP_OR_FQDN:~/

Here, the ssh runs on port 22 of the server. We make adequate changes when ssh listens on alternate port. Again, we give correct remote login details and set the directory to store the backup.

4. We, then make the script executable with the following code.

chmod +x /scripts/postcpbackup

5. After that we login to WHM and go to Main >> Backup >> Configure Backup to configure the backup plan.

6. Next, we set up Backup Destination to a local directory. For example “/backupdirect”.

7. Finally, we enable the option “Execute Pre/Post Backup Script” and set it as /scripts/postcpbackup and save.

 

2. How we configure Rsync backup settings in WHM

1. Initially, we login into WHM control panel.

2. We go to  Home > Backup > Backup Configuration.

3. Then we select Additional Destinations and to save the backups to additional destinations.

4. next, we select Destination Type as Rsync and click on create new destination.

5. After that, we fill the following field too.

  1. Destination Name
  2. Transfer System Backups to Destination: Select this checkbox to transfer the backup to the destination.
  3. Backup Directory.
  4. Remote Host:  we enter the hostname or IP address of the remote server.
  5. Port: By default, we use port 22 for Rsync communication to destinations.
  6. Remote Account Username: we enter the account username on the remote server.
  7. Authentication Type: we select either Key Authentication Options or Password Authentication Options.

6. At last, we click the Save Configuration button.

cPanel_rsync_backup

 

How we fixed rsync backup related errors in cPanel

From our experience in managing servers, we’ve seen customers facing problems while doing backup with rsync in cPanel. Let’s take a closer look at how our Migration Engineers fixed the problems.

 

1. Problem with user permissions

Recently one of our customers reported an error while taking rsync backup to a  remote server. He got an error like

" Validation for transport “bk-srv2” failed: Could not upload test file: child exited with code 1".

On checking, our Support Engineers found that the error was due to user permissions. The user added to access the remote server didn’t have permissions to read/write data on the VPS.

Therefore, we fixed the problem by correcting the permission of the user.

Also, this error can also happen when cPanel license expires or due to problems related to the cPanel License.

 

2. Missing command

Similarly, another customer came up with a problem while rsync the backup between the local server and the remote server. He got an error as follows. The error said,

bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(600) [sender=3.0.6]

Then, we found that the rsync was not installed on the remote server. But, it was already installed in the source server.

Therefore, we installed the rsync command on the remote server and that fixed the error.

 

[Having trouble while backup with rsync in cPanel? We’ll fix it for you.]

 

Conclusion

In short, one of the solutions to avoid disk storage problem is cPanel rsync backup to a remote server​. Today, we saw how our Migration Engineers set up rsync backup in WHM​ and fix related errors.

Leave a Comment

Your email address will not be published. Required fields are marked *

Social Share

Facebook
Twitter
LinkedIn
Telegram

Cheapest Web Hosting

Fasters Web Hosting Promo
Scroll to Top

Launch your Website at RS599

Create a professional website yourself with our domain hosting combo. Get Extra benefits at this Year end Sale with 10% OFF and Enjoy Amazing Deels on Shared Hosting!

Starting at Only RS599/Year

Year End Sale

Hours
Minutes
Seconds

Use Code STARTBIZ at Checkout.

Create an earning opportunity with A Web Hosting Business

Become reseller and start reselling domains, web hosting, ssl certificates and More.

45% OFF

Starting at RS399/Month

Hours
Minutes
Seconds

Use coupon: at the checkout.