How to take backup from one server and move to another server using SSH


When it comes to important information, it’s crucial for businesses to make sure that their data is protected and backed up in the event of an emergency. But unfortunately, today only about 50% of small and medium-sized businesses are confident that their data is being backed up properly. And many times they feel as if they lack with their technical experts or equipment to backup their critical data properly. But the truth is that disaster waits for no one and it can happen at any time and in any form.  Even something as harmless as accidentally dropping an important hard drive can throw a business into a tailspin. Regardless of the type of disaster that may occur to a business, you as a company may very well experience one. That’s where data backup comes into play.


Why Backup and Recovery Is Important


The main purpose of the backup is to create a copy of data that can be recovered in the event of a primary data failure. Because if there is a failure in the primary failure then it will result in hardware or software failure, data corruption or even human-caused event with malware attack or deleting the data accidentally. By having backup copies it allows data to be restored at any point of time which will help the business to recover from an unplanned event.


Moreover storing the copied data on a seprate medium is more critical to protect against the primary data loss or corruption. The alternate medium can be in the same location as the primary data or at a remote location. The possibility of weather-related events may justify having copies of data at remote locations. For best results, backup copies are made on a consistent, regular basis to minimize the amount data lost between backups. The more time passes between backup copies, then the more potential for data loss when recovering from a backup. Retaining multiple copies of data provides the insurance and flexibility to restore to a point in time not affected by data corruption or malicious attacks.


Login to the current server SSH (Putty)  from where the backup has to be generated.


Go to the home directory.

Cd /home


Enter the below command to generate the backup on the server.

sudo /scripts/pkgacct Username



username is the particular domain’s username.


Once the backup is completed, move the backup file to a particular account so that the backup should be downloadable.

Enter the below command for moving the backup file to a particular account.

mv cpmove-$user.tar.gz /home/$user/public_html



cpmove-$user.tar.gz is the backup file name.

$user is the username of the account, where the backup file is being moved.


After moving the backup to a particular account, correct the file permission of the backup file.


Go the current path where the backup file is moved.

Change the file permission to 644.

chmod 644 cpmove-$user.tar.gz


Now the backup file can be downloaded. So the next step.


Login to the New server SSH, where the backup has to be moved.


Download the backup file on the new server by running the below command.

wget http://$userdomain/cpmove-$user.tar.gz


Where, http://$userdomain/cpmove-$user.tar.gz is the backup file link.


Run the below command for restoring the backup on the new server.

sudo /scripts/restorepkg backup file name ex: username.tar.gz