Difference between revisions of "Rclone"

From Pulsed Media Wiki
(Guides: Information)
(Guides: Linux: Information: Pulsed Media)
 
Line 1: Line 1:
== Rclone ==
+
= Rclone =
  
'''Rclone''' is a free and open-source [[Command-line interface|command-line]] [[Computer program|program]] used to manage, synchronize, copy, move, and interact with [[Data storage|data]] on various [[Cloud storage]] providers, [[Local storage]] systems, and other remote services. Often described as the "[[rsync]] for [[Cloud storage]]", it supports a wide array of [[storage backend|storage backends]], allowing users to perform operations between different types of storage, including different [[Cloud storage]] providers, or between local storage and a [[Cloud storage]] service.
+
[[File:rclone.jpeg|thumb|right|300px|Illustrative rclone image.]]
  
Rclone is known for its extensive support for over 70 different [[storage backend|storage backends]] and its focus on providing a consistent [[Command-line interface|command-line]] experience for diverse storage technologies.
+
'''Rclone''' is a powerful, open-source, command-line program used for managing files on cloud storage and other remote storage systems. Often referred to as "The Swiss army knife of cloud storage," it provides features similar to Unix commands like rsync, cp, mv, mount, ls, and cat, but adapted for various cloud services.
  
=== Architecture and Design ===
+
Rclone supports over 70 cloud storage providers, including popular services like Google Drive, Amazon S3, Dropbox, Backblaze B2, Microsoft OneDrive, and standard protocols like SFTP, FTP, and WebDAV. It's designed to be efficient, reliable, and versatile for tasks ranging from backup and synchronization to data migration and mounting cloud storage as local drives.
  
Rclone is designed around the concept of "remotes" or "backends". A remote is a configuration entry that defines a connection to a specific [[Data storage|storage]] location, such as a [[Google Drive]] account, a specific bucket on [[Amazon S3]], a local directory, or an [[SFTP server]]. Users configure these remotes with necessary credentials or [[API]] keys.
+
== Core Features ==
 +
Rclone offers a wide array of functionalities for file management:
  
The core of Rclone is its [[Command-line interface|command-line]] interface, which provides a standard set of commands (like `copy`, `sync`, `move`, `ls`, `mkdir`, `delete`) that can be used with any configured remote. This abstracts away the differences in APIs and protocols used by various storage providers.
+
  '''Copy:''' Copies new or changed files from source to destination.
  
Key design aspects include:
+
  '''Sync:''' Makes a source and destination directory identical, typically in one direction.
* '''Backend Abstraction:''' A modular design where support for each [[storage backend|storage backend]] is implemented as a distinct module, allowing easy addition of new services.
 
* '''Command-line Focus:''' Primarily designed to be used from a [[Shell (computing)|shell]] or script, making it suitable for automation, scripting, and use on [[Server (computing)|servers]].
 
* '''Pluggable Features:''' Features like [[Encryption (cryptography)|encryption]] and filtering are implemented as layers or options that can be applied universally across different remotes.
 
  
=== Key Features and Functionality ===
+
  '''Move:''' Moves files from source to destination, deleting them from the source after verification.
  
Rclone provides a comprehensive set of functionalities for managing [[Data storage|data]]:
+
  '''Mount:''' Mounts any local, cloud, or virtual filesystem as a standard disk on your operating system.
  
* '''File Operations:''' Supports fundamental operations like copying (`copy`), moving (`move`), deleting (`delete`, `purge`), and creating directories (`mkdir`). These operations can be performed between any two configured remotes, including local storage.
+
  '''Crypt:''' Provides client-side encryption of files before they are uploaded to cloud storage, and decryption upon download.
* '''Synchronization:''' The `sync` command synchronizes the content of a source and destination directory, making the destination identical to the source. This includes transferring new files, updating changed files, and deleting files present in the destination but not the source.
 
* '''Mounting:''' Rclone can mount a remote location as a [[Virtual file system|virtual filesystem]] on the local [[Operating System|operating system]] (using [[Filesystem in Userspace|FUSE]] on [[Unix-like]] systems and [[WinFsp]] on [[Microsoft Windows]]). This allows users to access and manage files on [[Cloud storage]] or remote servers using standard file explorer tools.
 
* '''Encryption:''' Provides robust [[Encryption (cryptography)|encryption]] capabilities, allowing users to encrypt file contents, filenames, and directory structures before uploading to any remote. This adds a layer of privacy and [[Computer security|security]], particularly when using untrusted [[Cloud storage]].
 
* '''Filtering:''' Supports powerful filtering rules based on file names, paths, sizes, modification times, and other criteria, allowing users to include or exclude specific files or directories from operations.
 
* '''Transfer Optimization:''' Includes features like multi-threaded transfers, chunked uploads, and checks based on size and modification time or [[Cryptographic hash function|checksums]] to optimize data transfer speed and efficiency.
 
* '''Remote Control:''' Offers an optional remote control [[API]] (`rc`) that allows other programs or scripts to control a running Rclone instance.
 
* '''Check and Compare:''' Commands to check the [[Integrity (computer security)|integrity]] of files by comparing [[Cryptographic hash function|checksums]] across different remotes and to list differences between directories.
 
  
=== Supported Storage Backends ===
+
  '''Check:''' Verifies file integrity by comparing hashes (e.g., MD5, SHA1) and checks for missing or extra files.
  
Rclone supports a wide and growing variety of [[storage backend|storage backends]], encompassing various types of [[Data storage|data]] services and protocols. These include:
+
  '''List:''' Various commands (ls, lsl, lsd, lsjson) to list files and directories on remotes.
  
* Major [[Cloud storage]] providers like [[Google Drive]], [[Dropbox]], [[OneDrive]], [[Box Crypto|Box]], [[Mega (service)|Mega]], [[pCloud]], and many others.
+
  '''Serve:''' Can serve remotes over protocols like SFTP, HTTP, WebDAV, and FTP.
* [[Object storage]] services compatible with [[Amazon S3]], such as [[Wasabi Hot Cloud Storage|Wasabi]], [[Backblaze B2]], [[DigitalOcean Spaces]], and various other S3-compatible platforms.
 
* [[WebDAV]] and [[FTP]]/[[SFTP]] servers.
 
* Specific services like [[Microsoft Azure]], [[Google Cloud Storage]], [[OpenStack Swift]], and others.
 
* Local [[File system|file systems]].
 
  
The full list of supported backends is extensive and detailed in the official documentation.
+
== Installation on Debian/Ubuntu ==
 +
Rclone is readily available in the package repositories for Debian-based systems.
  
=== Use Cases ===
+
'''Update System Packages:'''
 +
It's good practice to update your package list and upgrade existing packages before installing new software.
  
Rclone is widely used in various scenarios due to its flexibility and broad backend support:
+
  sudo apt update && sudo apt upgrade -y
  
* '''[[Backup software|Backup]] and [[Synchronization]]:''' Automating backups of local data to [[Cloud storage]] or synchronizing data between different locations.
+
'''Install Rclone:'''
* '''[[Cloud storage|Cloud Storage]] Management:''' Managing files and directories directly on [[Cloud storage]] from the [[Command-line interface|command line]], without needing to sync everything locally.
+
Install rclone directly from the Debian repositories.
* '''Migration:''' Transferring data between different [[Cloud storage]] providers or from a server to [[Cloud storage]].
 
* '''Mounting Cloud Drives:''' Accessing and editing files on [[Cloud storage]] as if they were on a local drive.
 
* '''[[Encryption (cryptography)|Encrypting]] Data:''' Ensuring data privacy by encrypting files before storing them on potentially less trusted remote locations.
 
* '''[[Seedbox]] Automation:''' Managing and moving data from [[seedbox]]es to [[Cloud storage]].
 
* '''Scripting and Automation:''' Integrating file transfer and management into larger [[Shell script|shell scripts]] or automation workflows like [[Cron jobs]].
 
  
=== Graphical User Interfaces ===
+
  sudo apt install rclone
  
While Rclone's primary interface is the [[Command-line interface|command line]], several graphical frontends have been developed by the community to provide a more traditional desktop application experience. Some versions of Rclone also include a built-in, browser-based web interface. These GUIs utilize the Rclone executable in the background to perform operations.
+
'''Verify Installation:'''
 +
Check the installed version to confirm rclone is working correctly.
  
=== Comparison with rsync ===
+
  rclone version
  
Rclone is often compared to [[rsync]], a well-established utility for file synchronization and transfer, particularly over [[SSH]] or on local systems. The key distinction is Rclone's native support for a wide range of [[Cloud storage]] and object storage backends, which [[rsync]] lacks.
+
This command will output the rclone version, OS/architecture, and Go language version it was compiled with.
  
{| class="wikitable"
+
== Configuration (Adding a Cloud Storage Remote) ==
|+ Comparison between Rclone and rsync
+
Before using rclone to transfer files, you need to configure it to connect to your specific cloud storage provider. This involves an interactive setup process.
|-
 
! Feature
 
! Rclone
 
! rsync
 
|-
 
! Primary Focus
 
| [[Cloud storage]] & diverse remotes
 
| Local & SSH/remote servers
 
|-
 
! Cloud Backend Support
 
| Yes (Native & Extensive)
 
| No (Requires mounting or FUSE)
 
|-
 
! Local & SSH/Remote Support
 
| Yes
 
| Yes
 
|-
 
! [[Encryption (cryptography)|Encryption]] (built-in)
 
| Yes (File content, name, metadata)
 
| No (Requires external tools like GnuPG)
 
|-
 
! Mount Remote Drive
 
| Yes (using FUSE/WinFsp)
 
| No
 
|-
 
! Delta Transfer
 
| No (uploads/downloads whole files if changed)
 
| Yes (efficiently transfers only changed parts within files)
 
|-
 
! Bandwidth Control
 
| Yes (Detailed)
 
| Yes (Basic rate limiting)
 
|-
 
! GUI Options
 
| Yes (Community-developed & Web UI)
 
| No (CLI only)
 
|-
 
! Supported Protocols/Services
 
| 70+ Backends (S3, Drive, Dropbox, WebDAV, SFTP, etc.)
 
| Local, Shell/SSH, Rsync protocol
 
|}
 
The primary advantage of [[rsync]] is its efficient [[Delta encoding|delta transfer]] algorithm for updating parts of files, which Rclone does not implement; Rclone typically transfers entire files that have changed. Rclone's strength lies in its breadth of support for various storage services and its mounting capability.
 
  
=== Licensing ===
+
'''Start Configuration:'''
 +
Initiate the interactive configuration by running:
  
Rclone is free and open-source software licensed under the [[MIT License]].
+
  rclone config
  
=== See Also ===
+
If it's your first time, it will prompt: No remotes found, make a new one? (y/n)
  
* [[rsync]]
+
'''Create a New Remote:'''
* [[SFTP]]
+
Type n (for new remote) and press Enter.
* [[Command-line interface]]
+
You will then be asked for a name for your new remote. This name will be used to refer to your cloud storage in rclone commands.
 +
 
 +
  n) New remote
 +
  s) Set configuration password
 +
  q) Quit config
 +
  x) Advanced config
 +
  y) Same as New remote but skip name
 +
  e) Edit existing remote
 +
  r) Rename remote
 +
  c) Copy remote
 +
  rc) Show remote configs
 +
  d) Delete remote
 +
  p) Print existing remotes
 +
 
 +
Current remotes:
 +
 
 +
  n) New remote
 +
  s) Set configuration password
 +
  q) Quit config
 +
  e) Edit existing remote
 +
  r) Rename remote
 +
  c) Copy remote
 +
  d) Delete remote
 +
  p) Print existing remotes
 +
 
 +
Enter name for new remote.
 +
name> pulsedmedia.com Server
 +
 
 +
(Replace [[Pulsed Media]] Server with your preferred name).
 +
 
 +
'''Choose Storage Type:'''
 +
A list of supported cloud storage providers will appear. Type the number corresponding to your desired service.
 +
 
 +
Type of storage to configure.
 +
    ... (long list of options) ...
 +
    13 / pulsedmedia.com
 +
    \ "drive"
 +
  ... (rest of list) ...
 +
  Storage> 13
 +
 
 +
'''Follow Provider-Specific Prompts:'''
 +
Rclone will then ask for details specific to your chosen cloud provider. Follow these prompts carefully. Many options can be left as default by pressing Enter.
 +
 
 +
'''Save Remote:'''
 +
Once all details are entered and authentication (if required) is complete, rclone will ask to save the remote.
 +
 
 +
  y) Yes this is OK (default)
 +
  e) Edit this remote
 +
  d) Delete this remote
 +
  y/e/d> y
 +
 
 +
Type y and press Enter to save the remote.
 +
 
 +
'''Quit Configuration:'''
 +
You can now quit the configuration session.
 +
 
 +
  q) Quit config
 +
  e) Edit existing remote
 +
...
 +
  q) Quit config
 +
  > q
 +
 
 +
== Basic Usage Examples ==
 +
Here are some common rclone commands. Replace pulsedmedia.com with the name of your configured remote and /path/to/local/folder with your local directory.
 +
 
 +
'''List Contents of a Remote Directory:'''
 +
To see the files and folders in the root of your remote:
 +
 
 +
rclone ls pulsedmedia.com:
 +
 
 +
To list contents of a specific folder on your remote:
 +
 
 +
rclone ls pulsedmedia.com:pulsedmedia-server2.com/
 +
 
 +
'''Copy Files from Local to Remote:'''
 +
Copies a single file from your local machine to the remote:
 +
 
 +
  rclone copy /path/to/local/file.txt pulsedmedia.com:
 +
 
 +
Copies an entire folder from your local machine to a folder on the remote:
 +
 
 +
  rclone copy /path/to/local/folder pulsedmedia.com:pulsedmedia-server2.com
 +
 
 +
'''Copy Files from Remote to Local:'''
 +
Copies a file from the remote to your local machine:
 +
 
 +
  rclone copy MyGoogleDrive:MyRemoteFile.txt /path/to/local/downloads/
 +
 
 +
Copies an entire folder from the remote to your local machine:
 +
 
 +
  rclone copy pulsedmedia.com:pulsedmedia-server2.com
 +
  /path/to/local/downloads/
 +
 
 +
'''Synchronize a Local Folder with a Remote Folder (One-Way):'''
 +
This command makes the destination identical to the source. Files that exist in the destination but not in the source will be deleted from the destination. Use with caution!
 +
 
 +
  rclone sync /path/to/local/folder pulsedmedia.com:RemoteBackupFolder
 +
 
 +
'''Always test with --dry-run first:'''
 +
 
 +
  rclone sync --dry-run /path/to/local/folder pulsedmedia.com:RemoteBackupFolder
 +
 
 +
'''Move Files from Local to Remote:'''
 +
Moves (copies and then deletes from source) files from your local machine to the remote:
 +
 
 +
  rclone move /path/to/local/folder pulsedmedia.com:ProcessedFiles
 +
 
 +
'''Mount a Remote as a Local Drive:'''
 +
Requires fuse to be installed (sudo apt install fuse). This allows you to access your cloud storage as if it were a local folder.
 +
 
 +
  mkdir ~/my_cloud_mount
 +
  rclone mount pulsedmedia.com: ~/my_cloud_mount --vfs-cache-mode full &
 +
 
 +
The & puts the process in the background. To unmount:
 +
 
 +
  fusermount -u ~/my_cloud_mount
 +
 
 +
== See Also ==
 +
 
 +
*[[Command-line interface]]
 +
*[[rsync]]
 +
 
 +
[[Category:Information]]
 +
[[Category:Guides]]

Latest revision as of 11:58, 9 June 2025

Rclone

Illustrative rclone image.

Rclone is a powerful, open-source, command-line program used for managing files on cloud storage and other remote storage systems. Often referred to as "The Swiss army knife of cloud storage," it provides features similar to Unix commands like rsync, cp, mv, mount, ls, and cat, but adapted for various cloud services.

Rclone supports over 70 cloud storage providers, including popular services like Google Drive, Amazon S3, Dropbox, Backblaze B2, Microsoft OneDrive, and standard protocols like SFTP, FTP, and WebDAV. It's designed to be efficient, reliable, and versatile for tasks ranging from backup and synchronization to data migration and mounting cloud storage as local drives.

Core Features

Rclone offers a wide array of functionalities for file management:

 Copy: Copies new or changed files from source to destination.
 Sync: Makes a source and destination directory identical, typically in one direction.
 Move: Moves files from source to destination, deleting them from the source after verification.
 Mount: Mounts any local, cloud, or virtual filesystem as a standard disk on your operating system.
 Crypt: Provides client-side encryption of files before they are uploaded to cloud storage, and decryption upon download.
 Check: Verifies file integrity by comparing hashes (e.g., MD5, SHA1) and checks for missing or extra files.
 List: Various commands (ls, lsl, lsd, lsjson) to list files and directories on remotes.
 Serve: Can serve remotes over protocols like SFTP, HTTP, WebDAV, and FTP.

Installation on Debian/Ubuntu

Rclone is readily available in the package repositories for Debian-based systems.

Update System Packages: It's good practice to update your package list and upgrade existing packages before installing new software.

 sudo apt update && sudo apt upgrade -y

Install Rclone: Install rclone directly from the Debian repositories.

 sudo apt install rclone

Verify Installation: Check the installed version to confirm rclone is working correctly.

 rclone version

This command will output the rclone version, OS/architecture, and Go language version it was compiled with.

Configuration (Adding a Cloud Storage Remote)

Before using rclone to transfer files, you need to configure it to connect to your specific cloud storage provider. This involves an interactive setup process.

Start Configuration: Initiate the interactive configuration by running:

 rclone config

If it's your first time, it will prompt: No remotes found, make a new one? (y/n)

Create a New Remote: Type n (for new remote) and press Enter. You will then be asked for a name for your new remote. This name will be used to refer to your cloud storage in rclone commands.

 n) New remote
 s) Set configuration password
 q) Quit config
 x) Advanced config
 y) Same as New remote but skip name
 e) Edit existing remote
 r) Rename remote
 c) Copy remote
 rc) Show remote configs
 d) Delete remote
 p) Print existing remotes

Current remotes:

 n) New remote
 s) Set configuration password
 q) Quit config
 e) Edit existing remote
 r) Rename remote
 c) Copy remote
 d) Delete remote
 p) Print existing remotes

Enter name for new remote. name> pulsedmedia.com Server

(Replace Pulsed Media Server with your preferred name).

Choose Storage Type: A list of supported cloud storage providers will appear. Type the number corresponding to your desired service.

Type of storage to configure.

   ... (long list of options) ...
   13 / pulsedmedia.com
    \ "drive"
 ... (rest of list) ...
 Storage> 13

Follow Provider-Specific Prompts: Rclone will then ask for details specific to your chosen cloud provider. Follow these prompts carefully. Many options can be left as default by pressing Enter.

Save Remote: Once all details are entered and authentication (if required) is complete, rclone will ask to save the remote.

 y) Yes this is OK (default)
 e) Edit this remote
 d) Delete this remote
 y/e/d> y

Type y and press Enter to save the remote.

Quit Configuration: You can now quit the configuration session.

 q) Quit config
 e) Edit existing remote

...

 q) Quit config
 > q

Basic Usage Examples

Here are some common rclone commands. Replace pulsedmedia.com with the name of your configured remote and /path/to/local/folder with your local directory.

List Contents of a Remote Directory: To see the files and folders in the root of your remote:

rclone ls pulsedmedia.com:

To list contents of a specific folder on your remote:

rclone ls pulsedmedia.com:pulsedmedia-server2.com/

Copy Files from Local to Remote: Copies a single file from your local machine to the remote:

 rclone copy /path/to/local/file.txt pulsedmedia.com:

Copies an entire folder from your local machine to a folder on the remote:

 rclone copy /path/to/local/folder pulsedmedia.com:pulsedmedia-server2.com

Copy Files from Remote to Local: Copies a file from the remote to your local machine:

 rclone copy MyGoogleDrive:MyRemoteFile.txt /path/to/local/downloads/

Copies an entire folder from the remote to your local machine:

 rclone copy pulsedmedia.com:pulsedmedia-server2.com
 /path/to/local/downloads/

Synchronize a Local Folder with a Remote Folder (One-Way): This command makes the destination identical to the source. Files that exist in the destination but not in the source will be deleted from the destination. Use with caution!

 rclone sync /path/to/local/folder pulsedmedia.com:RemoteBackupFolder

Always test with --dry-run first:

 rclone sync --dry-run /path/to/local/folder pulsedmedia.com:RemoteBackupFolder

Move Files from Local to Remote: Moves (copies and then deletes from source) files from your local machine to the remote:

 rclone move /path/to/local/folder pulsedmedia.com:ProcessedFiles

Mount a Remote as a Local Drive: Requires fuse to be installed (sudo apt install fuse). This allows you to access your cloud storage as if it were a local folder.

 mkdir ~/my_cloud_mount
 rclone mount pulsedmedia.com: ~/my_cloud_mount --vfs-cache-mode full &

The & puts the process in the background. To unmount:

 fusermount -u ~/my_cloud_mount

See Also