Rsync is currently the most powerful tool for securely and freely performing backups and synchronizations to another server on Linux. It\'s a remote application that helps you transfer files efficiently. It\'s currently available for Unix-like systems and Microsoft Windows. The main features of Rsync are: * Copying links (shortcuts), devices, owners, groups, and permissions. * Does not require sudo privileges. * Data transfers are performed using pipelines to minimize latency costs. By using rsync on Linux, you can transfer and synchronize both files and directories between a remote server and another server (external or your own PC).

Installing Rsync

On Debian and Ubuntu
 
apt-get install rsync
On CentOS
 
yum install rsync

External Transfer Method

Rsync can transfer files via SSH, in which case the receiving server must also have Rsync installed. Like all applications with years of development, there are many ways to use it Rsync on Wikipedia. Personally, I\'ve found the following very useful:

Case 1

If you want to transfer a folder exclusively to another server using SSH:

rsync -vPa -e \'ssh -o StrictHostKeyChecking=no\' /var/www/ 154.14.123.1:/var/www/
By adding the StrictHostKeyChecking parameter to the SSH connection, we will allow the fingerprint to be automatically added to the .known_hosts file. In this case, we will be transferring the contents of our /var/www/ folder to the /var/www/ folder located on the server at IP address 154.14.123.1. When you execute this command, if both servers allow SSH connections, it will request the password of the destination server and begin copying the data gradually.

Case 2

If you want to transfer a VPS to another VPS. Ideally, both should be running the same Linux distribution, but with a little experimentation, this isn\'t strictly necessary, provided you exclude critical folders and files from the operation of the VPS (/vps): You should create a text file with the paths to exclude during data migration:

/boot

/dev

/tmp

/sys

/proc

/backup

/etc/fstab
/etc/mtab
/etc/mdadm.conf
/etc/sysconfig/network*
You can name it excludes.txt Later, as in case 1, we\'ll use the same command but with an additional parameter (--exclude-from):
rsync -vPa -e \'ssh -o StrictHostKeyChecking=no\' --exclude-from=/excludes.txt / 154.14.123.1:/

Conclusion

Rsync is a very powerful tool for secure data migration. It is very important that both servers (remote and external) have rsync installed to perform this operation. In our experience with VPS, working with this tool has been very satisfactory, allowing us to perform large data migrations with very little effort. It has more than one hundred options or parameter lists that we encourage you to discover and experiment with.