Those who have been using the main distributions for a long time GNU/Linux you are certainly familiar with the rsync utility. The latter is essentially a tool file synchronization local, often used to copy and synchronize files between folders on a single system or between local systems. rcloneinstead, focuses on the synchronization and management of data between local systems and services cloud storage.
rclone is an open source application that provides a command-line interface to manage files stored on cloud services, both the most famous and lesser-known platforms. Its name derives from the union of “rsync” e “clone“, as it aims to provide rsync-like functionality for syncing files and folders, but is designed to communicate with services cloud accessible online. Among the most well-known names are Google Drive, Dropbox, Amazon S3, Microsoft OneDrive, Box but the complete list is available on the Supported providers page.
The utility offers options for encrypt data during transmission and/or in remote cloud storage, providing a high level of security. Furthermore, which is uncommon, it can be used for transfer the data directly between two cloud services without going through local storage. This is a significant advantage because it avoids having to carry out a download procedure and then a further upload with the usually narrower bandwidth of the locally available connections (not everyone has FTTH fiber connectivity at 1 Gbps or more or FTTC from 200Mbps).
In this regard, however, rclone is capable of optimizing data transfer operations to reduce waiting times and use of the network bandwidth.
Furthermore, the availability of the option is very interesting
--dry-runwhich allows you to see the results of the set rclone command in advance and reduce the risk of deleting crucial files.
How to install rclone in Windows
In the past we have already seen how to backup and synchronize data on Linux using rclone. This time we focus on using Windows and we expand the “scope” to all cloud storage services available on the market.
Il package manager official Microsoft, that is winget, helps to automatically install applications in Windows and gives you the opportunity to set up rclone in the blink of an eye. Just open a window PowerShell in Windows 10 or Windows 11 (you can do this by pressing
Windows+X therefore choosing Windows PowerShell or Terminal) then issue the following instruction:
winget install Rclone.Rclone
Once therclone installation in Windows, just write the following command to start the program configuration:
By pressing the button
n then Enter, you are prompted to configure a new profile for the backup and data synchronization on the cloud. You can specify a name that is descriptive of the data synchronization operation you are setting up.
Choose the cloud storage service to use with rclone
rclone shows a long list of cloud platforms with which it can dialogue: each of them is characterized by a Numerical code (for example, Google Drive is number 18; OneDrive is number 34; Dropbox is number 13).
Continuing, corresponding to the requests
client_secret for the moment it is possible to press Enter, leaving both fields empty.
Subsequent requests differ based on the chosen cloud provider and deal with, for example, i access rights or with the selection of region where the data centers are located.
When the message “User web browser to automatically authenticate rclone with remote?”, it is good to press
Y then authorize theauthentication by rclone via web browser. In the example in the figure, we are asking for theaccess to OneDrive.
Assigning access privileges to rclone, via web browser
Microsoft (as well as any other cloud storage service) asks for confirmation that rclone can interact with all the data stored on its servers. With one click Acceptrclone is automatically added to the list of connected apps to your own account. L’authorization it may possibly be revoked later using the dedicated page “Apps and services to which you have granted access“.
After the message “Success!” browser side, it is possible complete the configuration via the PowerShell window. Upon request “Keep this “NomeCloud” remote” you can simply press Enter to accept the token set to. Pressing Enter is equivalent to entering
In the place of
NomeCloud, rclone displays the name initially assigned to the backup and synchronization procedure. To exit configuration, just press the button
q (Quit) then Enter.
How to use rclone for backup and sync
rclone ls NomeCloud: and by pressing Enter, the utility displays all the contents of the remote folder hosted on the cloud storage service. Don’t forget the final colon, substituting a
NomeCloudthe name of the previously created share.
Using PowerShell or the classic interface File Explorer of Windows, it is at this point possible to create a folder whose contents will be synced to the cloud.
For example, let’s create the folder
c:\backup-sync (from PowerShell or Command Prompt, just type
md c:\backup-sync and press Enter). So let’s try to save a file there. You can start by creating, in your local folder
c:\backup-sync, a test text file. For example
TEST-SYNC.txt with the text
test sincronizzazione inside.
We then type the following command for create a backup folder and synchronization on the remote cloud storage service:
rclone mkdir NomeCloud:backup-sync
As usual, instead of
NomeCloudthe name of the share, as previously specified in rclone. In the example command, it requires the creation of a folder called
backup-sync on the cloud service. By accessing the cloud storage service interface from the web, you will immediately see the reference to the new folder just created appear.
Try local to remote cloud sync: Here’s the simple command to use
A very simple command, which requires adding the option
--dry-run mentioned at the beginning, allows you to verify which files will be copied on the cloud, without starting the actual operation. The following instruction gives you the opportunity to check what will happen next as soon as you go to confirm the data transfer:
rclone sync --dry-run c:\backup-sync NomeCloud:backup-sync
In the place of
NomeCloud:backup-sync obviously the name of the share and the remote folder that will host the files must be specified. Path
c:\backup-sync instead it must be replaced with the name of the local folder containing the files to be transferred.
To authorize the actual synchronization, obviously just remove the reference to the option
rclone sync c:\backup-sync NomeCloud:backup-sync
Synchronize from cloud to local system
Data synchronization can also take place in the other direction, i.e. from the cloud storage service to the local system. The syntax is similar to the one seen previously, with the difference that the order of the folders must be reversed. The two previous commands are then transformed into the following:
rclone sync --dry-run NomeCloud:backup-sync c:\backup-sync
rclone sync NomeCloud:backup-sync c:\backup-sync
As you can see, in fact, the origin of the data (the cloud) is indicated in the first position, followed by the local folder, destination of the files and information stored on remote servers.
How to request two-way sync
By combining the commands seen previously, it is possible to activate a two-way synchronization of data between the local directory and the remote cloud system. New or modified files are then copied in both directions.
rclone also supports more complex syntax. In the following example, the contents of the local directory are synchronized with the remote system, excluding files with the extension
.tmp e limiting bandwidth a 2 Mbps:
rclone sync --exclude '*.tmp' --bwlimit 2M c:\backup-sync NomeCloud:backup-sync
Before using rclone “in production”, our suggestion is to practice its use and simulate various scenarios. Not before having activated local and cloud backup tools, so as to avoid any…