Rclone vs. Rsync

Rclone vs. Rsync: In this article, we take a closer look at two command-line tools that are used for backups: rclone and rsync.

Rclone vs. Rsync

Summary

Rclone and rsync are command-line tools. Rclone is designed for copying files between cloud servers and a different server or workstation, while rsync offers more advanced features for file synchronization.

image_pdfimage_print

It’s common for administrators to synchronize files between servers, and rclone and rsync are two command-line tools used to create backups or keep files updated across multiple servers. Both tools are used for backups, but they have their differences that might make one better for your business requirements. These two tools are especially useful for copying files between cloud and on-premises servers for backups and disaster recovery. Let’s dive into Rclone vs. Rsync.

What Is Rclone?

Copying files can be done with numerous user interfaces, but rclone is a command-line tool specifically designed for copying files between cloud servers and another server or workstation. With simple tools, an interruption in service stops the file synchronization and copying processes. The rclone tool can recover if the connection between the workstation and server is interrupted.

Several notable cloud services support rclone including Amazon S3 buckets, Microsoft OneDrive, Dropbox, Google Cloud Storage, Google Drive, Microsoft Azure Blob and File Storage, and several other providers. Administrators use rclone for unidirectional file synchronization, meaning that files are copied from a source to a destination only.

What Is Rsync?

For true synchronization, the rsync tool will perform a verification of both source and destination and copy files based on the most updated version. The rsync tool does a delta transfer, meaning that the most recent changes to files are checked and then the most recent version of a file is the one copied to either the source or the destination. Only changed files are copied to the destination, so rsync requires less bandwidth.

Administrators often use rsync for backups to reduce bandwidth use instead of performing a full backup every time. The rsync tool is bidirectional, and file attributes are preserved during synchronization, meaning any permissions or restrictions are preserved when the file is copied. Compared to the rclone tool, the rsync command has several more options for more advanced file synchronization.

Differences between Rclone and Rsync

The rclone tool is a solution mainly used for cloud synchronization and simple copies of files from a source to a destination, while the rsync tool has more advanced features. For example, if you need to define the type of shell to open during file transfer, rsync should be used. If you need a quick copy from a cloud source to a local server, the rclone tool might be a better choice. Quick copies of database files or directories are optimally done with rclone.

For true synchronization where copying files must be bidirectional, you need the rsync tool. The delta validation feature will copy the most recently updated file and overwrite the older version. Quick backups requiring a simple unidirectional copy might be better with the rclone tool. Only the rsync tool preserves file attributes (e.g., hidden or read-only), so if you need to keep them during synchronization then rclone will not be sufficient for backups.

How to Use Rclone 

Before you work with rclone, you need to download the binary file for your operating system. The rclone tool works with Windows, Mac, or Linux, so make sure you download the binary file for the operating system where rclone will be installed. You then need to run the rclone config command to configure the tool for your source and destination. Configuration depends on the cloud provider, so follow the rclone documentation for your configurations.

To use rclone, let’s use a simple cloud storage location with Google Drive. You first need to run the Google Drive configuration script to mount the drive. With Google Drive configured, you can now list directories on the remote drive using the command:

rclone lsd remote:

To create a backup of a directory and copy it to a local directory, use the following command:

rclone copy /home/source remote:backup

This is a simple example, but the basic steps to using rclone include:

  1. Download the binary file.
  2. Run the configuration script provided by the rclone developers.
  3. Execute your backup command after mounting the remote drive.

Best Practices for Rsync

Many Linux administrators work with rsync, and it’s often used for large file transfers. Think millions of files to synchronize rather than a basic system with a few hundred files. One advantage of rsync is that it performs a differential copy, so it copies only files with recent changes since the last backup. Scanning the entire system for differential changes requires a scan of the source and the destination system, so it’s best to define directories specific for backup synchronization.

A few best practices when using rsync:

  • Always keep rsync updated to the latest version.
  • Test your scripts before deploying them to avoid data loss.
  • Avoid the -checksum option if you need better performance, but know that rsync will rely on the modified date to synchronize a file.
  • Limit file synchronization to only directories and files that must be included in backups.
  • Make sure that the server running rsync has plenty of RAM.

Conclusion on Rclone vs. Rsync

Backups are always a concern for administrators, and rclone and rsync can make it easier to create scripts without using large third-party applications. Both have their own advantages based on the type of backups, but they also run in a command line for easier configuration. To ensure that you have the backup infrastructure to support your file storage, check out Pure Storage’s cloud block storage solution.

Navigating changes at Broadcom VMware by modernizing your virtualization strategy for future flexibility, certainty and scale

Written By: