- ¿Cómo realizar un respaldo / backup en VPS con Rsync?
How to make a backup / backup in VPS with Rsync?
Learn how to make a backup on your Linux VPS using Rsync and SSH
Léelo en Español
/ 3-5 mins.
Rsync is today the most powerful tool to perform backups and synchronizations to another server safely and freely in Linux. It is an application that works remotely and helps you transfer files efficiently. Today it is found for Unix-like and Microsoft Windows systems.
The main features of Rsync are:
* Copy links (shortcuts), devices, owners, groups and permissions.
* Does not require sudo privileges
* Data transfers are via pipelines to minimize latency costs.
By using rsync in linux, you will be able to transfer and synchronize both files and directories between a remote server and another server (external or your own pc).
apt-get install rsync
yum install rsync
External transfer method
Rsync can transfer via SSH
, in which case the receiving server must also have Rsync. Like all applications with years of development there are many ways to use it Rsync on Wikipedia
. Personally, the following has been very useful:
If you want to transfer a folder exclusively to another server using SSH:
rsync -vPa -e 'ssh -o StrictHostKeyChecking = no' / var / www / 188.8.131.52:/var/www/
By adding the StrictHostKeyChecking
parameter to the SSH connection, we will allow the introduction of the fingerprint to the .known_hosts file automatically.
In this case, we will be transferring the content of our / var / www / folder to the / var / www / folder contained within the server located at IP 184.108.40.206. When executing that instruction, if both servers allow SSH connections, it will ask for the destination server's password and progressively start copying data.
If you want to transfer a VPS to another VPS. Ideally both should understand the same Linux distribution, but experimenting a bit is not so necessary under the condition of excluding critical files and folders from the operation of the VPS
You should create a text file with the paths to exclude in the data migration:
/ etc / fstab
/ etc / mtab
/ etc / sysconfig / network *
You can name it excludes.txt
Later, as in case 1, we will call the same instruction but with an additional parameter (--exclude-from)
rsync -vPa -e 'ssh -o StrictHostKeyChecking = no' --exclude-from = / excludes.txt / 220.127.116.11: /
Rsync is a very powerful tool for secure data migration. It is very important that both servers (remote and external) have rsync to be able to carry out this execution.
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 a hundred options or lists of parameters that we invite you to discover and experiment.
- Compártelo con tus amigos