Data Transfer/Rclone: Difference between revisions
H Schumacher (talk | contribs) m (added best practices) |
H Schumacher (talk | contribs) m (improved Windows instructions) |
||
| (12 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
Rclone is a command line tool to manage files on remote systems (e.g. cloud storage systems). Rclone either synchronizes in one direction only or its mounting functionality is used with <code>rclone mount</code>. Data can be piped between two completely remote locations, sometimes without local download. One advantage is that the transfer is multithreaded and it operates on a file level basis. |
[https://rclone.org/docs/ Rclone] is a command line tool to manage files on remote systems (e.g. cloud storage systems). Rclone either synchronizes in one direction only or its mounting functionality is used with <code>rclone mount</code>. Data can be piped between two completely remote locations, sometimes without local download. One advantage is that the transfer is multithreaded and it operates on a file level basis. |
||
'''Caution:''' You can't use Rclone with 2FA. |
|||
== Installation == |
== Installation == |
||
| Line 12: | Line 13: | ||
Detailed information regarding different operating systems can be found here: |
Detailed information regarding different operating systems can be found here: |
||
* Installation on [https://rclone.org/install/#script-installation Linux] |
|||
* Installation on [https://rclone.org/install/#macos macOS] |
|||
* Installation on [https://rclone.org/install/#windows Windows] |
* Installation on [https://rclone.org/install/#windows Windows] |
||
* Installation on [https://rclone.org/install/#macos macOS] |
|||
** If Rclone shall be used together with sftp, the [[Data_Transfer/SSHFS#Installation | sshfs installation]] instructions must be followed after installing Rclone. |
|||
* Installation on [https://rclone.org/install/#script-installation Linux] |
|||
== Usage Rclone == |
== Usage Rclone == |
||
To use Rclone you have to define a config file. Afterwards you can connect by using the name of your configured connections. |
|||
A detailed explanation on how to use Rclone can be found here <link>.<br /> |
|||
Before you can get started, you need to set up a client. Therefore, run <code>rclone config</code> to set up a new connection. |
|||
=== Configure Remote === |
|||
An example is provided for [[Data_Transfer/WebDAV|setting up a WebDAV connection with a remote system]]. |
|||
Before you can start using Rclone, you need to set up a remote. This means to configure a specific connection by providing authentication information, the network protocol that you want to use and a name for this configuration so that you can use it later on. |
|||
To configure a remote for a specific service, you need the following information: |
|||
* <code><remotehost></code> |
|||
* <code><username></code> |
|||
* <code><servicePassword></code> |
|||
Furthermore, you have to decide on: |
|||
* <code>network protocol</code> (for example webDAV, smb, sftp) |
|||
* <code>remote-name</code> (for example you can use the name of the service you want to connect to) |
|||
You have three different options to set up a new remote as described in the following sections. It's enough to choose one of those. |
|||
<span style="font-size: 1.1em; text-decoration: underline;">'''Oneliner''' </span> |
|||
Open a terminal and define all parameters in one command. If a ssh key shall be used instead of a password, it might be easier to adjust the config file directly as described in the next section. |
|||
<syntaxhighlight lang="bash"># smb |
|||
rclone config create <remote-name> smb host=<remotehost> user=<username> domain=<domain> pass=<password> --obscure |
|||
# sftp |
|||
rclone config create <remote-name> sftp host=<remotehost> user=<username> pass=<password> --obscure |
|||
# webdav |
|||
rclone config create <remote-name> webdav url=<remotehost> user=<username> pass=<password> --obscure |
|||
</syntaxhighlight> |
|||
<span style="font-size: 1.1em; text-decoration: underline;">'''Adjust Config File''' </span> |
|||
<syntaxhighlight lang="bash"> |
|||
# Make sure that a config file exists. Access rights for the config file are set to 600. |
|||
rclone config touch |
|||
# Get the location of the file: |
|||
rclone config file |
|||
</syntaxhighlight> |
|||
Open the file and use one of the following snippets as template for your connection: |
|||
<syntaxhighlight lang="bash">[<remote-name>] |
|||
type = smb |
|||
host = <hostname> |
|||
user = <userID> |
|||
domain = <e.g. BWSERVICESAD> |
|||
[<remote-name>] |
|||
type = webdav |
|||
url = <hostURL> |
|||
vendor = other |
|||
user = <userID> |
|||
[<remote-name>] |
|||
type = sftp |
|||
host = <hostname> |
|||
user = <userID> |
|||
key_use_agent = false |
|||
[<remote-name-ssh-key-version>] |
|||
type = sftp |
|||
host = <hostname> |
|||
user = <userID> |
|||
key_file = ~/.ssh/id_ed25519 |
|||
pubkey_file = ~/.ssh/id_ed25519.pub |
|||
key_use_agent = true |
|||
shell_type = none |
|||
</syntaxhighlight> |
|||
To add the password, please use the following command. Make sure to keep the prepended space so that the command is not saved in your command history. |
|||
<syntaxhighlight> rclone config update <remote-name> pass=<password> --obscure</syntaxhighlight> |
|||
<span style="font-size: 1.1em; text-decoration: underline;">'''Interactive Setup''' </span> |
|||
Execute: |
|||
<syntaxhighlight>rclone config</syntaxhighlight> |
|||
This will guide you through an interactive setup process. It's quite helpful for checking out which options there are and what the config file looks like after setting values that deviate from the default values. You can find detailed instructions at the website: |
|||
* [https://rclone.org/webdav/ Connect via webdav] |
|||
* [https://rclone.org/smb/ Connect via smb] |
|||
* [https://rclone.org/sftp/ Connect via sftp] |
|||
=== Use Remote === |
|||
To see all configured remotes: |
|||
<syntaxhighlight lang="bash">rclone config |
|||
# Exit with 'q'. |
|||
</syntaxhighlight> |
|||
The syntax to use Rclone is like this: |
The syntax to use Rclone is like this: |
||
| Line 27: | Line 109: | ||
<pre>rclone [options] subcommand <parameters> <parameters...> |
<pre>rclone [options] subcommand <parameters> <parameters...> |
||
</pre> |
</pre> |
||
List all |
List all elements in the folder XX: |
||
<syntaxhighlight lang="bash">rclone lsf <remote-name>:XX |
|||
# List elements from subfolders as well: |
|||
<pre>rclone lsd <client-name>:XX |
|||
rclone lsf --max-depth 2 <remote-name>:XX |
|||
</pre> |
|||
</syntaxhighlight> |
|||
Copies /local/path to the remote path |
Copies /local/path to the remote path |
||
<pre>rclone copy </local/path> < |
<pre>rclone copy </local/path> <remote-name>:<remote/path> |
||
</pre> |
</pre> |
||
Copies fom remote path to /local/path |
Copies fom remote path to /local/path |
||
<pre>rclone copy < |
<pre>rclone copy <remote-name>:<remote/path> </local/path> |
||
</pre> |
</pre> |
||
Moves the contents of the source directory to the destination directory. |
Moves the contents of the source directory to the destination directory. |
||
<pre>rclone move < |
<pre>rclone move <remote-name>:<source/path> <remote-name>:<destination/path> |
||
</pre> |
</pre> |
||
More subcommands can be found [https://rclone.org/docs/#subcommands here]. |
More subcommands can be found [https://rclone.org/docs/#subcommands here]. |
||
| Line 47: | Line 130: | ||
== Usage Rclone Mount == |
== Usage Rclone Mount == |
||
Before you can follow the instructions in this chapter, you need to have set up a [[Data_Transfer/Rclone#Usage_Rclone | remote]].</br> |
|||
Detailed information on how to use rclone mount can be found [https://rclone.org/commands/rclone_mount/ here]. |
|||
More detailed information on how to use rclone mount can be found [https://rclone.org/commands/rclone_mount/ here]. |
|||
=== |
=== Windows === |
||
To run rclone mount on Windows, you will need to [https://winfsp.dev/rel/ download and install WinFsp] first. |
|||
You can run mount in either foreground or background (aka daemon) mode. Mount runs in foreground mode by default. Use the <code>--daemon</code> flag to force background mode. |
|||
<syntaxhighlight lang="python"># mount under drive letter X (or any other free letter) |
|||
Create an empty directory on your local machine and then execute |
|||
rclone mount --vfs-cache-mode full <remote-name>:<path/to/remote/files> X: |
|||
# or provide the path to a nonexisting folder: |
|||
rclone mount --vfs-cache-mode full <remote-name>:<path/to/remote/files> <C:\path\parentDir\nonexistingFoldername></syntaxhighlight> |
|||
To unmount, the command can be stopped in the terminal with the key combination CTRL+C. Alternatively, a mounted drive can be unmounted by making a right click on the drive name in the file explorer and choose "Eject". </br> |
|||
In contrast to Linux/Mac, there is no background mode. |
|||
=== MacOS & Linux === |
|||
<pre># to mount the root folder: |
|||
rclone mount --vfs-cache-mode full <client-name>: /path/to/empty/folder |
|||
# to mount a subfolder: |
|||
rclone mount --vfs-cache-mode full <client-name>:folderX/folderY /path/to/empty/folder </pre> |
|||
=== Windows === |
|||
You can run mount in either foreground or background (aka daemon) mode. Mount runs in foreground mode by default. Use the <code>--daemon</code> flag to force background mode. If this doesn't work, you can put an <code>&</code> at the end of the command instead. |
|||
To run rclone mount on Windows, you will need to [https://winfsp.dev/rel/ download and install WinFsp]. To mount on drive letter X or a nonexistent subdirectory, use: |
|||
Create an empty directory on your local machine and then execute |
|||
<pre>rclone mount <client-name>:path/to/files X: |
|||
rclone mount <client-name>:path/to/files C:\path\parent\mount</pre> |
|||
<syntaxhighlight lang="bash"># to mount the root folder: |
|||
In contrast to Linux/Mac, there is no background mode. |
|||
rclone mount --vfs-cache-mode full <remote-name>: /path/to/empty/folder |
|||
# to mount a subfolder: |
|||
rclone mount --vfs-cache-mode full <remote-name>:folderX/folderY /path/to/empty/folder |
|||
# to unmount: |
|||
fusermount -uz /path/to/mounted/folder </syntaxhighlight> |
|||
== Best |
== Best Practices == |
||
Rclone has a lot of useful options. |
Rclone has a lot of useful options. |
||
Latest revision as of 18:01, 27 May 2026
Rclone is a command line tool to manage files on remote systems (e.g. cloud storage systems). Rclone either synchronizes in one direction only or its mounting functionality is used with rclone mount. Data can be piped between two completely remote locations, sometimes without local download. One advantage is that the transfer is multithreaded and it operates on a file level basis.
Caution: You can't use Rclone with 2FA.
Installation
Rclone is a Go program and comes as a single binary file.
- Download the relevant binary.
- Extract the
rcloneexecutable,rclone.exeon Windows, from the archive. - You can use the executables without further installation. For easy use, it is recommended to add the binary to your PATH environment variable. Information on how to do this can be found below.
Detailed information regarding different operating systems can be found here:
- Installation on Windows
- Installation on macOS
- If Rclone shall be used together with sftp, the sshfs installation instructions must be followed after installing Rclone.
- Installation on Linux
Usage Rclone
To use Rclone you have to define a config file. Afterwards you can connect by using the name of your configured connections.
Configure Remote
Before you can start using Rclone, you need to set up a remote. This means to configure a specific connection by providing authentication information, the network protocol that you want to use and a name for this configuration so that you can use it later on.
To configure a remote for a specific service, you need the following information:
<remotehost><username><servicePassword>
Furthermore, you have to decide on:
network protocol(for example webDAV, smb, sftp)remote-name(for example you can use the name of the service you want to connect to)
You have three different options to set up a new remote as described in the following sections. It's enough to choose one of those.
Oneliner
Open a terminal and define all parameters in one command. If a ssh key shall be used instead of a password, it might be easier to adjust the config file directly as described in the next section.
# smb
rclone config create <remote-name> smb host=<remotehost> user=<username> domain=<domain> pass=<password> --obscure
# sftp
rclone config create <remote-name> sftp host=<remotehost> user=<username> pass=<password> --obscure
# webdav
rclone config create <remote-name> webdav url=<remotehost> user=<username> pass=<password> --obscure
Adjust Config File
# Make sure that a config file exists. Access rights for the config file are set to 600.
rclone config touch
# Get the location of the file:
rclone config file
Open the file and use one of the following snippets as template for your connection:
[<remote-name>]
type = smb
host = <hostname>
user = <userID>
domain = <e.g. BWSERVICESAD>
[<remote-name>]
type = webdav
url = <hostURL>
vendor = other
user = <userID>
[<remote-name>]
type = sftp
host = <hostname>
user = <userID>
key_use_agent = false
[<remote-name-ssh-key-version>]
type = sftp
host = <hostname>
user = <userID>
key_file = ~/.ssh/id_ed25519
pubkey_file = ~/.ssh/id_ed25519.pub
key_use_agent = true
shell_type = none
To add the password, please use the following command. Make sure to keep the prepended space so that the command is not saved in your command history.
rclone config update <remote-name> pass=<password> --obscureInteractive Setup
Execute:
rclone configThis will guide you through an interactive setup process. It's quite helpful for checking out which options there are and what the config file looks like after setting values that deviate from the default values. You can find detailed instructions at the website:
Use Remote
To see all configured remotes:
rclone config
# Exit with 'q'.
The syntax to use Rclone is like this:
rclone [options] subcommand <parameters> <parameters...>
List all elements in the folder XX:
rclone lsf <remote-name>:XX
# List elements from subfolders as well:
rclone lsf --max-depth 2 <remote-name>:XX
Copies /local/path to the remote path
rclone copy </local/path> <remote-name>:<remote/path>
Copies fom remote path to /local/path
rclone copy <remote-name>:<remote/path> </local/path>
Moves the contents of the source directory to the destination directory.
rclone move <remote-name>:<source/path> <remote-name>:<destination/path>
More subcommands can be found here.
Usage Rclone Mount
Before you can follow the instructions in this chapter, you need to have set up a remote.
More detailed information on how to use rclone mount can be found here.
Windows
To run rclone mount on Windows, you will need to download and install WinFsp first.
# mount under drive letter X (or any other free letter)
rclone mount --vfs-cache-mode full <remote-name>:<path/to/remote/files> X:
# or provide the path to a nonexisting folder:
rclone mount --vfs-cache-mode full <remote-name>:<path/to/remote/files> <C:\path\parentDir\nonexistingFoldername>
To unmount, the command can be stopped in the terminal with the key combination CTRL+C. Alternatively, a mounted drive can be unmounted by making a right click on the drive name in the file explorer and choose "Eject".
In contrast to Linux/Mac, there is no background mode.
MacOS & Linux
You can run mount in either foreground or background (aka daemon) mode. Mount runs in foreground mode by default. Use the --daemon flag to force background mode. If this doesn't work, you can put an & at the end of the command instead.
Create an empty directory on your local machine and then execute
# to mount the root folder:
rclone mount --vfs-cache-mode full <remote-name>: /path/to/empty/folder
# to mount a subfolder:
rclone mount --vfs-cache-mode full <remote-name>:folderX/folderY /path/to/empty/folder
# to unmount:
fusermount -uz /path/to/mounted/folder
Best Practices
Rclone has a lot of useful options.
Performance
To be able to utilize a larger bandwidth, it is helpful to add the following options for increased performance:
--transfers <int>
Number of file transfers to run in parallel (default: 4). Depending on the local Network, read and write speeds on the file system, and current load, different values might be best. For large transfers, it is advised to test local performance with different values beforehand.
- In our tests, we observed the best results between 8 and 32.
- For regular use cases, we recommend 16 as the default.
- Values above 64 are not recommended and degrade performance.
--multi-thread-streams <int>
Number of streams to use for multithreaded downloads (default: 4). Only important on very large files. This will cause multithreaded up/download on chunk-sized bits of the file.
The optimal value is highly specific to the local network and used Hardware. For regular use cases, we recommend 4 as the default.
Debugging and Statistics
To get updates on current progress, use:
--stats
Interval between printing stats, e.g. 500ms, 60s, 5m (0 to disable) (default 1m0s).
To get debug information, use:
--log-level=DEBUG --stats-log-level=DEBUG