Backing up using rsync

After rsync has been setup on both the machines, we are now ready to send data back and forth. The rsync command is very simple, almost like the cp command that we all have been using for so long. A simple rsync command looks like this:

rsync  [OPTIONS]  SRC  DEST

How to Use Rsync to Make a Remote Linux Backup

Imagine losing all your data by accidentally doing sudo rm -rf /someDirectory, sucks right? But it happens to the best of us. Now, if it was a Windows system, we could have used numerous backup options like OneDrive to secure our data. But what about Linux? Fortunately, we have some very robust tools to backup our Linux system too, and one of them is rsync.

Short for Remote SYNC, rsync is a CLI backup utility through which you can perform both local and remote backups in a secure and efficient way. It is secure because it uses SSH (secure shell) and efficient because it supports something called as incremental backup. Now what is incremental backup? In simple terms, rsync compares the file size and last modified time, and backs up only those files that have changed. rsync has become the industry standard to backup Linux systems for the last two decades because of a few additional reasons too, which are beyond the scope of this article.

Alright, enough theory. Now let’s see how to backup our Linux system to a remote computer using rsync.

Similar Reads

Preparing for backup

You need to have rsync installed on both the source and destination machines. Generally, it comes preinstalled with most distros. You can check it by doing:...

Backing up using rsync

After rsync has been setup on both the machines, we are now ready to send data back and forth. The rsync command is very simple, almost like the cp command that we all have been using for so long. A simple rsync command looks like this:...

Options Available in rsync in Linux

Option Description -r recurse into directories -z compress file data during the transfer -s use the protocol to safely send the args -v increase verbosity...

Conclusion

rsync is a very powerful tool. Do you want to learn one more cool trick? You can write a bash script for performing backup, and schedule a cron job to automatically run the file. And boom, you have your own automatic backup solution, just like OneDrive or Google Drive. I suggest you play with all the options of rsync, if you want to fully understand its potential. You should also check out rclone, which was inspired by rsync and offers similar functionalities for the cloud! For example, you can copy contents to and from Google Drive, or AWS S3. You can also use rclone to sync directories between clouds, like OneDrive and Google Drive!...