Copying data between servers is the backbone of any System Admin job. Data has to be correct without any errors and accessible to those who needed it. In the distant past, admins could use Rsync to copy data between servers via the Terminal, but with the advent of Cloud computing and storage, now data can be spread over several services and used by hundreds of individuals. This is where Rclone comes into play.
Rclone is Rsync for multiple cloud based storage. It is a Terminal-based utility that syncs folders and files not only to the local filesystem, but also to Google Drive, OneDrive, Dropbox and Amazon, among others.
Rclone is available as source from the site or within most repositories of major Linux distributions. As I use Ubuntu, it was just a case of installing it via the Terminal:
sudo apt install rclone
Once installed, users need to make some configuration changes. Enter the following:
You will be presented with the following screen:
The terminology is a little ambiguous, but for this we want a new connection, so we choose ‘n.’ The terminal will move along and ask you to select the storage provider type that you want to use. In this case, Google Drive.
Rclone will then ask if you want an auto setup. I selected “yes,” and it gave me a link to open. This will lead you to your provider login, so that you can authorize Rclone to use the service.
The Terminal will then report success and ask if you want to continue and provide access token details, which I obviously won’t screenshot. One final thing to do is to encrypt your connection and password. This is generally a good idea, as passing the information in plain text is not advised.
With the encryption set, you can type the following to list your cloud files. Note that you need to use the name of the storage you selected, so in my case this was “Google,” but you may have called it something else. I would advise sticking to the company or brand name, especially if you have several cloud storage accounts.
rclone ls Google:
This will pull every file that you have, which for some users will be a huge amount, so it is better to search by Directory using:
rclone lsd Google:
Now you can copy files to the cloud storage by entering the following commands from the Terminal:
rclone copy /path/to Google:Foldername
In the above example I wanted to copy the screenshots for this tutorial into the a folder called “Toshiba” within my Google Drive. The screenshots below show the local files and then the files as they are within my cloud storage. Change the above command “path/to” for the directory you want to copy. For instance, in my case it was:
rclone copy home/ubuntu/Pictures Google:Toshiba
Rclone can also delete files and directories and can be found within the online documentation.
Rclone provides a quick and relatively safe way for users to back up essential files from the Terminal. Whether or not it still has a place within the Linux toolset can be argued. Personally, I find it useful, but less experienced users may struggle with the setup and GUI-less environment. What is your favourite method of backing up? Do you use Rclone, or do you prefer more conventional methods? Let us know in the comments section.
Our latest tutorials delivered straight to your inbox