mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 11:58:20 +08:00
docs: factor large docs into separate .md files to make them easier to maintain.
We then use the go embed command to embed them back into the binary.
This commit is contained in:
parent
e67157cf46
commit
831d1df67f
|
@ -3,6 +3,7 @@ package mountlib
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
_ "embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
@ -27,6 +28,9 @@ import (
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:embed mount.md
|
||||||
|
var mountHelp string
|
||||||
|
|
||||||
// Options for creating the mount
|
// Options for creating the mount
|
||||||
type Options struct {
|
type Options struct {
|
||||||
DebugFUSE bool
|
DebugFUSE bool
|
||||||
|
@ -158,7 +162,7 @@ func NewMountCommand(commandName string, hidden bool, mount MountFn) *cobra.Comm
|
||||||
Use: commandName + " remote:path /path/to/mountpoint",
|
Use: commandName + " remote:path /path/to/mountpoint",
|
||||||
Hidden: hidden,
|
Hidden: hidden,
|
||||||
Short: `Mount the remote as file system on a mountpoint.`,
|
Short: `Mount the remote as file system on a mountpoint.`,
|
||||||
Long: strings.ReplaceAll(strings.ReplaceAll(mountHelp, "|", "`"), "@", commandName) + vfs.Help,
|
Long: strings.ReplaceAll(mountHelp, "@", commandName) + vfs.Help,
|
||||||
Annotations: map[string]string{
|
Annotations: map[string]string{
|
||||||
"versionIntroduced": "v1.33",
|
"versionIntroduced": "v1.33",
|
||||||
"groups": "Filter",
|
"groups": "Filter",
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
package mountlib
|
|
||||||
|
|
||||||
// "@" will be replaced by the command name, "|" will be replaced by backticks
|
|
||||||
var mountHelp = `
|
|
||||||
rclone @ allows Linux, FreeBSD, macOS and Windows to
|
rclone @ allows Linux, FreeBSD, macOS and Windows to
|
||||||
mount any of Rclone's cloud storage systems as a file system with
|
mount any of Rclone's cloud storage systems as a file system with
|
||||||
FUSE.
|
FUSE.
|
||||||
|
|
||||||
First set up your remote using |rclone config|. Check it works with |rclone ls| etc.
|
First set up your remote using `rclone config`. Check it works with `rclone ls` etc.
|
||||||
|
|
||||||
On Linux and macOS, you can run mount in either foreground or background (aka
|
On Linux and macOS, you can run mount in either foreground or background (aka
|
||||||
daemon) mode. Mount runs in foreground mode by default. Use the |--daemon| flag
|
daemon) mode. Mount runs in foreground mode by default. Use the `--daemon` flag
|
||||||
to force background mode. On Windows you can run mount in foreground only,
|
to force background mode. On Windows you can run mount in foreground only,
|
||||||
the flag is ignored.
|
the flag is ignored.
|
||||||
|
|
||||||
|
@ -18,7 +14,7 @@ program starts, spawns background rclone process to setup and maintain the
|
||||||
mount, waits until success or timeout and exits with appropriate code
|
mount, waits until success or timeout and exits with appropriate code
|
||||||
(killing the child process if it fails).
|
(killing the child process if it fails).
|
||||||
|
|
||||||
On Linux/macOS/FreeBSD start the mount like this, where |/path/to/local/mount|
|
On Linux/macOS/FreeBSD start the mount like this, where `/path/to/local/mount`
|
||||||
is an **empty** **existing** directory:
|
is an **empty** **existing** directory:
|
||||||
|
|
||||||
rclone @ remote:path/to/files /path/to/local/mount
|
rclone @ remote:path/to/files /path/to/local/mount
|
||||||
|
@ -29,10 +25,10 @@ rclone will serve the mount and occupy the console so another window should be
|
||||||
used to work with the mount until rclone is interrupted e.g. by pressing Ctrl-C.
|
used to work with the mount until rclone is interrupted e.g. by pressing Ctrl-C.
|
||||||
|
|
||||||
The following examples will mount to an automatically assigned drive,
|
The following examples will mount to an automatically assigned drive,
|
||||||
to specific drive letter |X:|, to path |C:\path\parent\mount|
|
to specific drive letter `X:`, to path `C:\path\parent\mount`
|
||||||
(where parent directory or drive must exist, and mount must **not** exist,
|
(where parent directory or drive must exist, and mount must **not** exist,
|
||||||
and is not supported when [mounting as a network drive](#mounting-modes-on-windows)), and
|
and is not supported when [mounting as a network drive](#mounting-modes-on-windows)), and
|
||||||
the last example will mount as network share |\\cloud\remote| and map it to an
|
the last example will mount as network share `\\cloud\remote` and map it to an
|
||||||
automatically assigned drive:
|
automatically assigned drive:
|
||||||
|
|
||||||
rclone @ remote:path/to/files *
|
rclone @ remote:path/to/files *
|
||||||
|
@ -89,7 +85,7 @@ as a network drive instead.
|
||||||
|
|
||||||
When mounting as a fixed disk drive you can either mount to an unused drive letter,
|
When mounting as a fixed disk drive you can either mount to an unused drive letter,
|
||||||
or to a path representing a **nonexistent** subdirectory of an **existing** parent
|
or to a path representing a **nonexistent** subdirectory of an **existing** parent
|
||||||
directory or drive. Using the special value |*| will tell rclone to
|
directory or drive. Using the special value `*` will tell rclone to
|
||||||
automatically assign the next available drive letter, starting with Z: and moving backward.
|
automatically assign the next available drive letter, starting with Z: and moving backward.
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
|
@ -98,45 +94,45 @@ Examples:
|
||||||
rclone @ remote:path/to/files C:\path\parent\mount
|
rclone @ remote:path/to/files C:\path\parent\mount
|
||||||
rclone @ remote:path/to/files X:
|
rclone @ remote:path/to/files X:
|
||||||
|
|
||||||
Option |--volname| can be used to set a custom volume name for the mounted
|
Option `--volname` can be used to set a custom volume name for the mounted
|
||||||
file system. The default is to use the remote name and path.
|
file system. The default is to use the remote name and path.
|
||||||
|
|
||||||
To mount as network drive, you can add option |--network-mode|
|
To mount as network drive, you can add option `--network-mode`
|
||||||
to your @ command. Mounting to a directory path is not supported in
|
to your @ command. Mounting to a directory path is not supported in
|
||||||
this mode, it is a limitation Windows imposes on junctions, so the remote must always
|
this mode, it is a limitation Windows imposes on junctions, so the remote must always
|
||||||
be mounted to a drive letter.
|
be mounted to a drive letter.
|
||||||
|
|
||||||
rclone @ remote:path/to/files X: --network-mode
|
rclone @ remote:path/to/files X: --network-mode
|
||||||
|
|
||||||
A volume name specified with |--volname| will be used to create the network share path.
|
A volume name specified with `--volname` will be used to create the network share path.
|
||||||
A complete UNC path, such as |\\cloud\remote|, optionally with path
|
A complete UNC path, such as `\\cloud\remote`, optionally with path
|
||||||
|\\cloud\remote\madeup\path|, will be used as is. Any other
|
`\\cloud\remote\madeup\path`, will be used as is. Any other
|
||||||
string will be used as the share part, after a default prefix |\\server\|.
|
string will be used as the share part, after a default prefix `\\server\`.
|
||||||
If no volume name is specified then |\\server\share| will be used.
|
If no volume name is specified then `\\server\share` will be used.
|
||||||
You must make sure the volume name is unique when you are mounting more than one drive,
|
You must make sure the volume name is unique when you are mounting more than one drive,
|
||||||
or else the mount command will fail. The share name will treated as the volume label for
|
or else the mount command will fail. The share name will treated as the volume label for
|
||||||
the mapped drive, shown in Windows Explorer etc, while the complete
|
the mapped drive, shown in Windows Explorer etc, while the complete
|
||||||
|\\server\share| will be reported as the remote UNC path by
|
`\\server\share` will be reported as the remote UNC path by
|
||||||
|net use| etc, just like a normal network drive mapping.
|
`net use` etc, just like a normal network drive mapping.
|
||||||
|
|
||||||
If you specify a full network share UNC path with |--volname|, this will implicitly
|
If you specify a full network share UNC path with `--volname`, this will implicitly
|
||||||
set the |--network-mode| option, so the following two examples have same result:
|
set the `--network-mode` option, so the following two examples have same result:
|
||||||
|
|
||||||
rclone @ remote:path/to/files X: --network-mode
|
rclone @ remote:path/to/files X: --network-mode
|
||||||
rclone @ remote:path/to/files X: --volname \\server\share
|
rclone @ remote:path/to/files X: --volname \\server\share
|
||||||
|
|
||||||
You may also specify the network share UNC path as the mountpoint itself. Then rclone
|
You may also specify the network share UNC path as the mountpoint itself. Then rclone
|
||||||
will automatically assign a drive letter, same as with |*| and use that as
|
will automatically assign a drive letter, same as with `*` and use that as
|
||||||
mountpoint, and instead use the UNC path specified as the volume name, as if it were
|
mountpoint, and instead use the UNC path specified as the volume name, as if it were
|
||||||
specified with the |--volname| option. This will also implicitly set
|
specified with the `--volname` option. This will also implicitly set
|
||||||
the |--network-mode| option. This means the following two examples have same result:
|
the `--network-mode` option. This means the following two examples have same result:
|
||||||
|
|
||||||
rclone @ remote:path/to/files \\cloud\remote
|
rclone @ remote:path/to/files \\cloud\remote
|
||||||
rclone @ remote:path/to/files * --volname \\cloud\remote
|
rclone @ remote:path/to/files * --volname \\cloud\remote
|
||||||
|
|
||||||
There is yet another way to enable network mode, and to set the share path,
|
There is yet another way to enable network mode, and to set the share path,
|
||||||
and that is to pass the "native" libfuse/WinFsp option directly:
|
and that is to pass the "native" libfuse/WinFsp option directly:
|
||||||
|--fuse-flag --VolumePrefix=\server\share|. Note that the path
|
`--fuse-flag --VolumePrefix=\server\share`. Note that the path
|
||||||
must be with just a single backslash prefix in this case.
|
must be with just a single backslash prefix in this case.
|
||||||
|
|
||||||
|
|
||||||
|
@ -157,15 +153,15 @@ representing permissions for the POSIX permission scopes: Owner, group and other
|
||||||
By default, the owner and group will be taken from the current user, and the built-in
|
By default, the owner and group will be taken from the current user, and the built-in
|
||||||
group "Everyone" will be used to represent others. The user/group can be customized
|
group "Everyone" will be used to represent others. The user/group can be customized
|
||||||
with FUSE options "UserName" and "GroupName",
|
with FUSE options "UserName" and "GroupName",
|
||||||
e.g. |-o UserName=user123 -o GroupName="Authenticated Users"|.
|
e.g. `-o UserName=user123 -o GroupName="Authenticated Users"`.
|
||||||
The permissions on each entry will be set according to [options](#options)
|
The permissions on each entry will be set according to [options](#options)
|
||||||
|--dir-perms| and |--file-perms|, which takes a value in traditional Unix
|
`--dir-perms` and `--file-perms`, which takes a value in traditional Unix
|
||||||
[numeric notation](https://en.wikipedia.org/wiki/File-system_permissions#Numeric_notation).
|
[numeric notation](https://en.wikipedia.org/wiki/File-system_permissions#Numeric_notation).
|
||||||
|
|
||||||
The default permissions corresponds to |--file-perms 0666 --dir-perms 0777|,
|
The default permissions corresponds to `--file-perms 0666 --dir-perms 0777`,
|
||||||
i.e. read and write permissions to everyone. This means you will not be able
|
i.e. read and write permissions to everyone. This means you will not be able
|
||||||
to start any programs from the mount. To be able to do that you must add
|
to start any programs from the mount. To be able to do that you must add
|
||||||
execute permissions, e.g. |--file-perms 0777 --dir-perms 0777| to add it
|
execute permissions, e.g. `--file-perms 0777 --dir-perms 0777` to add it
|
||||||
to everyone. If the program needs to write files, chances are you will
|
to everyone. If the program needs to write files, chances are you will
|
||||||
have to enable [VFS File Caching](#vfs-file-caching) as well (see also
|
have to enable [VFS File Caching](#vfs-file-caching) as well (see also
|
||||||
[limitations](#limitations)). Note that the default write permission have
|
[limitations](#limitations)). Note that the default write permission have
|
||||||
|
@ -193,12 +189,12 @@ will be added automatically for compatibility with Unix. Some example use
|
||||||
cases will following.
|
cases will following.
|
||||||
|
|
||||||
If you set POSIX permissions for only allowing access to the owner,
|
If you set POSIX permissions for only allowing access to the owner,
|
||||||
using |--file-perms 0600 --dir-perms 0700|, the user group and the built-in
|
using `--file-perms 0600 --dir-perms 0700`, the user group and the built-in
|
||||||
"Everyone" group will still be given some special permissions, as described
|
"Everyone" group will still be given some special permissions, as described
|
||||||
above. Some programs may then (incorrectly) interpret this as the file being
|
above. Some programs may then (incorrectly) interpret this as the file being
|
||||||
accessible by everyone, for example an SSH client may warn about "unprotected
|
accessible by everyone, for example an SSH client may warn about "unprotected
|
||||||
private key file". You can work around this by specifying
|
private key file". You can work around this by specifying
|
||||||
|-o FileSecurity="D:P(A;;FA;;;OW)"|, which sets file all access (FA) to the
|
`-o FileSecurity="D:P(A;;FA;;;OW)"`, which sets file all access (FA) to the
|
||||||
owner (OW), and nothing else.
|
owner (OW), and nothing else.
|
||||||
|
|
||||||
When setting write permissions then, except for the owner, this does not
|
When setting write permissions then, except for the owner, this does not
|
||||||
|
@ -207,11 +203,11 @@ This may prevent applications from writing to files, giving permission denied
|
||||||
error instead. To set working write permissions for the built-in "Everyone"
|
error instead. To set working write permissions for the built-in "Everyone"
|
||||||
group, similar to what it gets by default but with the addition of the
|
group, similar to what it gets by default but with the addition of the
|
||||||
"write extended attributes", you can specify
|
"write extended attributes", you can specify
|
||||||
|-o FileSecurity="D:P(A;;FRFW;;;WD)"|, which sets file read (FR) and file
|
`-o FileSecurity="D:P(A;;FRFW;;;WD)"`, which sets file read (FR) and file
|
||||||
write (FW) to everyone (WD). If file execute (FX) is also needed, then change
|
write (FW) to everyone (WD). If file execute (FX) is also needed, then change
|
||||||
to |-o FileSecurity="D:P(A;;FRFWFX;;;WD)"|, or set file all access (FA) to
|
to `-o FileSecurity="D:P(A;;FRFWFX;;;WD)"`, or set file all access (FA) to
|
||||||
get full access permissions, including delete, with
|
get full access permissions, including delete, with
|
||||||
|-o FileSecurity="D:P(A;;FA;;;WD)"|.
|
`-o FileSecurity="D:P(A;;FA;;;WD)"`.
|
||||||
|
|
||||||
#### Windows caveats
|
#### Windows caveats
|
||||||
|
|
||||||
|
@ -235,7 +231,7 @@ It is also possible to make a drive mount available to everyone on the system,
|
||||||
by running the process creating it as the built-in SYSTEM account.
|
by running the process creating it as the built-in SYSTEM account.
|
||||||
There are several ways to do this: One is to use the command-line
|
There are several ways to do this: One is to use the command-line
|
||||||
utility [PsExec](https://docs.microsoft.com/en-us/sysinternals/downloads/psexec),
|
utility [PsExec](https://docs.microsoft.com/en-us/sysinternals/downloads/psexec),
|
||||||
from Microsoft's Sysinternals suite, which has option |-s| to start
|
from Microsoft's Sysinternals suite, which has option `-s` to start
|
||||||
processes as the SYSTEM account. Another alternative is to run the mount
|
processes as the SYSTEM account. Another alternative is to run the mount
|
||||||
command from a Windows Scheduled Task, or a Windows Service, configured
|
command from a Windows Scheduled Task, or a Windows Service, configured
|
||||||
to run as the SYSTEM account. A third alternative is to use the
|
to run as the SYSTEM account. A third alternative is to use the
|
||||||
|
@ -243,7 +239,7 @@ to run as the SYSTEM account. A third alternative is to use the
|
||||||
Read more in the [install documentation](https://rclone.org/install/).
|
Read more in the [install documentation](https://rclone.org/install/).
|
||||||
Note that when running rclone as another user, it will not use
|
Note that when running rclone as another user, it will not use
|
||||||
the configuration file from your profile unless you tell it to
|
the configuration file from your profile unless you tell it to
|
||||||
with the [|--config|](https://rclone.org/docs/#config-config-file) option.
|
with the [`--config`](https://rclone.org/docs/#config-config-file) option.
|
||||||
Note also that it is now the SYSTEM account that will have the owner
|
Note also that it is now the SYSTEM account that will have the owner
|
||||||
permissions, and other accounts will have permissions according to the
|
permissions, and other accounts will have permissions according to the
|
||||||
group or others scopes. As mentioned above, these will then not get the
|
group or others scopes. As mentioned above, these will then not get the
|
||||||
|
@ -300,21 +296,21 @@ of the file.
|
||||||
Rclone includes flags for unicode normalization with macFUSE that should be updated
|
Rclone includes flags for unicode normalization with macFUSE that should be updated
|
||||||
for FUSE-T. See [this forum post](https://forum.rclone.org/t/some-unicode-forms-break-mount-on-macos-with-fuse-t/36403)
|
for FUSE-T. See [this forum post](https://forum.rclone.org/t/some-unicode-forms-break-mount-on-macos-with-fuse-t/36403)
|
||||||
and [FUSE-T issue #16](https://github.com/macos-fuse-t/fuse-t/issues/16). The following
|
and [FUSE-T issue #16](https://github.com/macos-fuse-t/fuse-t/issues/16). The following
|
||||||
flag should be added to the |rclone mount| command.
|
flag should be added to the `rclone mount` command.
|
||||||
|
|
||||||
-o modules=iconv,from_code=UTF-8,to_code=UTF-8
|
-o modules=iconv,from_code=UTF-8,to_code=UTF-8
|
||||||
|
|
||||||
##### Read Only mounts
|
##### Read Only mounts
|
||||||
|
|
||||||
When mounting with |--read-only|, attempts to write to files will fail *silently* as
|
When mounting with `--read-only`, attempts to write to files will fail *silently* as
|
||||||
opposed to with a clear warning as in macFUSE.
|
opposed to with a clear warning as in macFUSE.
|
||||||
|
|
||||||
### Limitations
|
### Limitations
|
||||||
|
|
||||||
Without the use of |--vfs-cache-mode| this can only write files
|
Without the use of `--vfs-cache-mode` this can only write files
|
||||||
sequentially, it can only seek when reading. This means that many
|
sequentially, it can only seek when reading. This means that many
|
||||||
applications won't work with their files on an rclone mount without
|
applications won't work with their files on an rclone mount without
|
||||||
|--vfs-cache-mode writes| or |--vfs-cache-mode full|.
|
`--vfs-cache-mode writes` or `--vfs-cache-mode full`.
|
||||||
See the [VFS File Caching](#vfs-file-caching) section for more info.
|
See the [VFS File Caching](#vfs-file-caching) section for more info.
|
||||||
When using NFS mount on macOS, if you don't specify |--vfs-cache-mode|
|
When using NFS mount on macOS, if you don't specify |--vfs-cache-mode|
|
||||||
the mount point will be read-only.
|
the mount point will be read-only.
|
||||||
|
@ -324,9 +320,9 @@ do not support the concept of empty directories, so empty
|
||||||
directories will have a tendency to disappear once they fall out of
|
directories will have a tendency to disappear once they fall out of
|
||||||
the directory cache.
|
the directory cache.
|
||||||
|
|
||||||
When |rclone mount| is invoked on Unix with |--daemon| flag, the main rclone
|
When `rclone mount` is invoked on Unix with `--daemon` flag, the main rclone
|
||||||
program will wait for the background mount to become ready or until the timeout
|
program will wait for the background mount to become ready or until the timeout
|
||||||
specified by the |--daemon-wait| flag. On Linux it can check mount status using
|
specified by the `--daemon-wait` flag. On Linux it can check mount status using
|
||||||
ProcFS so the flag in fact sets **maximum** time to wait, while the real wait
|
ProcFS so the flag in fact sets **maximum** time to wait, while the real wait
|
||||||
can be less. On macOS / BSD the time to wait is constant and the check is
|
can be less. On macOS / BSD the time to wait is constant and the check is
|
||||||
performed only at the end. We advise you to set wait time on macOS reasonably.
|
performed only at the end. We advise you to set wait time on macOS reasonably.
|
||||||
|
@ -344,10 +340,10 @@ for solutions to make @ more reliable.
|
||||||
|
|
||||||
### Attribute caching
|
### Attribute caching
|
||||||
|
|
||||||
You can use the flag |--attr-timeout| to set the time the kernel caches
|
You can use the flag `--attr-timeout` to set the time the kernel caches
|
||||||
the attributes (size, modification time, etc.) for directory entries.
|
the attributes (size, modification time, etc.) for directory entries.
|
||||||
|
|
||||||
The default is |1s| which caches files just long enough to avoid
|
The default is `1s` which caches files just long enough to avoid
|
||||||
too many callbacks to rclone from the kernel.
|
too many callbacks to rclone from the kernel.
|
||||||
|
|
||||||
In theory 0s should be the correct value for filesystems which can
|
In theory 0s should be the correct value for filesystems which can
|
||||||
|
@ -358,14 +354,14 @@ few problems such as
|
||||||
and [excessive time listing directories](https://github.com/rclone/rclone/issues/2095#issuecomment-371141147).
|
and [excessive time listing directories](https://github.com/rclone/rclone/issues/2095#issuecomment-371141147).
|
||||||
|
|
||||||
The kernel can cache the info about a file for the time given by
|
The kernel can cache the info about a file for the time given by
|
||||||
|--attr-timeout|. You may see corruption if the remote file changes
|
`--attr-timeout`. You may see corruption if the remote file changes
|
||||||
length during this window. It will show up as either a truncated file
|
length during this window. It will show up as either a truncated file
|
||||||
or a file with garbage on the end. With |--attr-timeout 1s| this is
|
or a file with garbage on the end. With `--attr-timeout 1s` this is
|
||||||
very unlikely but not impossible. The higher you set |--attr-timeout|
|
very unlikely but not impossible. The higher you set `--attr-timeout`
|
||||||
the more likely it is. The default setting of "1s" is the lowest
|
the more likely it is. The default setting of "1s" is the lowest
|
||||||
setting which mitigates the problems above.
|
setting which mitigates the problems above.
|
||||||
|
|
||||||
If you set it higher (|10s| or |1m| say) then the kernel will call
|
If you set it higher (`10s` or `1m` say) then the kernel will call
|
||||||
back to rclone less often making it more efficient, however there is
|
back to rclone less often making it more efficient, however there is
|
||||||
more chance of the corruption issue above.
|
more chance of the corruption issue above.
|
||||||
|
|
||||||
|
@ -388,32 +384,32 @@ Units having the rclone @ service specified as a requirement
|
||||||
will see all files and folders immediately in this mode.
|
will see all files and folders immediately in this mode.
|
||||||
|
|
||||||
Note that systemd runs mount units without any environment variables including
|
Note that systemd runs mount units without any environment variables including
|
||||||
|PATH| or |HOME|. This means that tilde (|~|) expansion will not work
|
`PATH` or `HOME`. This means that tilde (`~`) expansion will not work
|
||||||
and you should provide |--config| and |--cache-dir| explicitly as absolute
|
and you should provide `--config` and `--cache-dir` explicitly as absolute
|
||||||
paths via rclone arguments.
|
paths via rclone arguments.
|
||||||
Since mounting requires the |fusermount| program, rclone will use the fallback
|
Since mounting requires the `fusermount` program, rclone will use the fallback
|
||||||
PATH of |/bin:/usr/bin| in this scenario. Please ensure that |fusermount|
|
PATH of `/bin:/usr/bin` in this scenario. Please ensure that `fusermount`
|
||||||
is present on this PATH.
|
is present on this PATH.
|
||||||
|
|
||||||
### Rclone as Unix mount helper
|
### Rclone as Unix mount helper
|
||||||
|
|
||||||
The core Unix program |/bin/mount| normally takes the |-t FSTYPE| argument
|
The core Unix program `/bin/mount` normally takes the `-t FSTYPE` argument
|
||||||
then runs the |/sbin/mount.FSTYPE| helper program passing it mount options
|
then runs the `/sbin/mount.FSTYPE` helper program passing it mount options
|
||||||
as |-o key=val,...| or |--opt=...|. Automount (classic or systemd) behaves
|
as `-o key=val,...` or `--opt=...`. Automount (classic or systemd) behaves
|
||||||
in a similar way.
|
in a similar way.
|
||||||
|
|
||||||
rclone by default expects GNU-style flags |--key val|. To run it as a mount
|
rclone by default expects GNU-style flags `--key val`. To run it as a mount
|
||||||
helper you should symlink rclone binary to |/sbin/mount.rclone| and optionally
|
helper you should symlink rclone binary to `/sbin/mount.rclone` and optionally
|
||||||
|/usr/bin/rclonefs|, e.g. |ln -s /usr/bin/rclone /sbin/mount.rclone|.
|
`/usr/bin/rclonefs`, e.g. `ln -s /usr/bin/rclone /sbin/mount.rclone`.
|
||||||
rclone will detect it and translate command-line arguments appropriately.
|
rclone will detect it and translate command-line arguments appropriately.
|
||||||
|
|
||||||
Now you can run classic mounts like this:
|
Now you can run classic mounts like this:
|
||||||
|||
|
```
|
||||||
mount sftp1:subdir /mnt/data -t rclone -o vfs_cache_mode=writes,sftp_key_file=/path/to/pem
|
mount sftp1:subdir /mnt/data -t rclone -o vfs_cache_mode=writes,sftp_key_file=/path/to/pem
|
||||||
|||
|
```
|
||||||
|
|
||||||
or create systemd mount units:
|
or create systemd mount units:
|
||||||
|||
|
```
|
||||||
# /etc/systemd/system/mnt-data.mount
|
# /etc/systemd/system/mnt-data.mount
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Mount for /mnt/data
|
Description=Mount for /mnt/data
|
||||||
|
@ -422,10 +418,10 @@ Type=rclone
|
||||||
What=sftp1:subdir
|
What=sftp1:subdir
|
||||||
Where=/mnt/data
|
Where=/mnt/data
|
||||||
Options=rw,_netdev,allow_other,args2env,vfs-cache-mode=writes,config=/etc/rclone.conf,cache-dir=/var/rclone
|
Options=rw,_netdev,allow_other,args2env,vfs-cache-mode=writes,config=/etc/rclone.conf,cache-dir=/var/rclone
|
||||||
|||
|
```
|
||||||
|
|
||||||
optionally accompanied by systemd automount unit
|
optionally accompanied by systemd automount unit
|
||||||
|||
|
```
|
||||||
# /etc/systemd/system/mnt-data.automount
|
# /etc/systemd/system/mnt-data.automount
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=AutoMount for /mnt/data
|
Description=AutoMount for /mnt/data
|
||||||
|
@ -434,34 +430,33 @@ Where=/mnt/data
|
||||||
TimeoutIdleSec=600
|
TimeoutIdleSec=600
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|||
|
```
|
||||||
|
|
||||||
or add in |/etc/fstab| a line like
|
or add in `/etc/fstab` a line like
|
||||||
|||
|
```
|
||||||
sftp1:subdir /mnt/data rclone rw,noauto,nofail,_netdev,x-systemd.automount,args2env,vfs_cache_mode=writes,config=/etc/rclone.conf,cache_dir=/var/cache/rclone 0 0
|
sftp1:subdir /mnt/data rclone rw,noauto,nofail,_netdev,x-systemd.automount,args2env,vfs_cache_mode=writes,config=/etc/rclone.conf,cache_dir=/var/cache/rclone 0 0
|
||||||
|||
|
```
|
||||||
|
|
||||||
or use classic Automountd.
|
or use classic Automountd.
|
||||||
Remember to provide explicit |config=...,cache-dir=...| as a workaround for
|
Remember to provide explicit `config=...,cache-dir=...` as a workaround for
|
||||||
mount units being run without |HOME|.
|
mount units being run without `HOME`.
|
||||||
|
|
||||||
Rclone in the mount helper mode will split |-o| argument(s) by comma, replace |_|
|
Rclone in the mount helper mode will split `-o` argument(s) by comma, replace `_`
|
||||||
by |-| and prepend |--| to get the command-line flags. Options containing commas
|
by `-` and prepend `--` to get the command-line flags. Options containing commas
|
||||||
or spaces can be wrapped in single or double quotes. Any inner quotes inside outer
|
or spaces can be wrapped in single or double quotes. Any inner quotes inside outer
|
||||||
quotes of the same type should be doubled.
|
quotes of the same type should be doubled.
|
||||||
|
|
||||||
Mount option syntax includes a few extra options treated specially:
|
Mount option syntax includes a few extra options treated specially:
|
||||||
|
|
||||||
- |env.NAME=VALUE| will set an environment variable for the mount process.
|
- `env.NAME=VALUE` will set an environment variable for the mount process.
|
||||||
This helps with Automountd and Systemd.mount which don't allow setting
|
This helps with Automountd and Systemd.mount which don't allow setting
|
||||||
custom environment for mount helpers.
|
custom environment for mount helpers.
|
||||||
Typically you will use |env.HTTPS_PROXY=proxy.host:3128| or |env.HOME=/root|
|
Typically you will use `env.HTTPS_PROXY=proxy.host:3128` or `env.HOME=/root`
|
||||||
- |command=cmount| can be used to run |cmount| or any other rclone command
|
- `command=cmount` can be used to run `cmount` or any other rclone command
|
||||||
rather than the default |mount|.
|
rather than the default `mount`.
|
||||||
- |args2env| will pass mount options to the mount helper running in background
|
- `args2env` will pass mount options to the mount helper running in background
|
||||||
via environment variables instead of command line arguments. This allows to
|
via environment variables instead of command line arguments. This allows to
|
||||||
hide secrets from such commands as |ps| or |pgrep|.
|
hide secrets from such commands as `ps` or `pgrep`.
|
||||||
- |vv...| will be transformed into appropriate |--verbose=N|
|
- `vv...` will be transformed into appropriate `--verbose=N`
|
||||||
- standard mount options like |x-systemd.automount|, |_netdev|, |nosuid| and alike
|
- standard mount options like `x-systemd.automount`, `_netdev`, `nosuid` and alike
|
||||||
are intended only for Automountd and ignored by rclone.
|
are intended only for Automountd and ignored by rclone.
|
||||||
`
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
|
_ "embed"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -35,6 +36,9 @@ import (
|
||||||
versionCmd "github.com/rclone/rclone/cmd/version"
|
versionCmd "github.com/rclone/rclone/cmd/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:embed selfupdate.md
|
||||||
|
var selfUpdateHelp string
|
||||||
|
|
||||||
// Options contains options for the self-update command
|
// Options contains options for the self-update command
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Check bool
|
Check bool
|
||||||
|
@ -63,7 +67,7 @@ var cmdSelfUpdate = &cobra.Command{
|
||||||
Use: "selfupdate",
|
Use: "selfupdate",
|
||||||
Aliases: []string{"self-update"},
|
Aliases: []string{"self-update"},
|
||||||
Short: `Update the rclone binary.`,
|
Short: `Update the rclone binary.`,
|
||||||
Long: strings.ReplaceAll(selfUpdateHelp, "|", "`"),
|
Long: selfUpdateHelp,
|
||||||
Annotations: map[string]string{
|
Annotations: map[string]string{
|
||||||
"versionIntroduced": "v1.55",
|
"versionIntroduced": "v1.55",
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,55 +1,47 @@
|
||||||
//go:build !noselfupdate
|
|
||||||
// +build !noselfupdate
|
|
||||||
|
|
||||||
package selfupdate
|
|
||||||
|
|
||||||
// Note: "|" will be replaced by backticks in the help string below
|
|
||||||
var selfUpdateHelp = `
|
|
||||||
This command downloads the latest release of rclone and replaces the
|
This command downloads the latest release of rclone and replaces the
|
||||||
currently running binary. The download is verified with a hashsum and
|
currently running binary. The download is verified with a hashsum and
|
||||||
cryptographically signed signature; see [the release signing
|
cryptographically signed signature; see [the release signing
|
||||||
docs](/release_signing/) for details.
|
docs](/release_signing/) for details.
|
||||||
|
|
||||||
If used without flags (or with implied |--stable| flag), this command
|
If used without flags (or with implied `--stable` flag), this command
|
||||||
will install the latest stable release. However, some issues may be fixed
|
will install the latest stable release. However, some issues may be fixed
|
||||||
(or features added) only in the latest beta release. In such cases you should
|
(or features added) only in the latest beta release. In such cases you should
|
||||||
run the command with the |--beta| flag, i.e. |rclone selfupdate --beta|.
|
run the command with the `--beta` flag, i.e. `rclone selfupdate --beta`.
|
||||||
You can check in advance what version would be installed by adding the
|
You can check in advance what version would be installed by adding the
|
||||||
|--check| flag, then repeat the command without it when you are satisfied.
|
`--check` flag, then repeat the command without it when you are satisfied.
|
||||||
|
|
||||||
Sometimes the rclone team may recommend you a concrete beta or stable
|
Sometimes the rclone team may recommend you a concrete beta or stable
|
||||||
rclone release to troubleshoot your issue or add a bleeding edge feature.
|
rclone release to troubleshoot your issue or add a bleeding edge feature.
|
||||||
The |--version VER| flag, if given, will update to the concrete version
|
The `--version VER` flag, if given, will update to the concrete version
|
||||||
instead of the latest one. If you omit micro version from |VER| (for
|
instead of the latest one. If you omit micro version from `VER` (for
|
||||||
example |1.53|), the latest matching micro version will be used.
|
example `1.53`), the latest matching micro version will be used.
|
||||||
|
|
||||||
Upon successful update rclone will print a message that contains a previous
|
Upon successful update rclone will print a message that contains a previous
|
||||||
version number. You will need it if you later decide to revert your update
|
version number. You will need it if you later decide to revert your update
|
||||||
for some reason. Then you'll have to note the previous version and run the
|
for some reason. Then you'll have to note the previous version and run the
|
||||||
following command: |rclone selfupdate [--beta] OLDVER|.
|
following command: `rclone selfupdate [--beta] OLDVER`.
|
||||||
If the old version contains only dots and digits (for example |v1.54.0|)
|
If the old version contains only dots and digits (for example `v1.54.0`)
|
||||||
then it's a stable release so you won't need the |--beta| flag. Beta releases
|
then it's a stable release so you won't need the `--beta` flag. Beta releases
|
||||||
have an additional information similar to |v1.54.0-beta.5111.06f1c0c61|.
|
have an additional information similar to `v1.54.0-beta.5111.06f1c0c61`.
|
||||||
(if you are a developer and use a locally built rclone, the version number
|
(if you are a developer and use a locally built rclone, the version number
|
||||||
will end with |-DEV|, you will have to rebuild it as it obviously can't
|
will end with `-DEV`, you will have to rebuild it as it obviously can't
|
||||||
be distributed).
|
be distributed).
|
||||||
|
|
||||||
If you previously installed rclone via a package manager, the package may
|
If you previously installed rclone via a package manager, the package may
|
||||||
include local documentation or configure services. You may wish to update
|
include local documentation or configure services. You may wish to update
|
||||||
with the flag |--package deb| or |--package rpm| (whichever is correct for
|
with the flag `--package deb` or `--package rpm` (whichever is correct for
|
||||||
your OS) to update these too. This command with the default |--package zip|
|
your OS) to update these too. This command with the default `--package zip`
|
||||||
will update only the rclone executable so the local manual may become
|
will update only the rclone executable so the local manual may become
|
||||||
inaccurate after it.
|
inaccurate after it.
|
||||||
|
|
||||||
The [rclone mount](/commands/rclone_mount/) command may
|
The [rclone mount](/commands/rclone_mount/) command may
|
||||||
or may not support extended FUSE options depending on the build and OS.
|
or may not support extended FUSE options depending on the build and OS.
|
||||||
|selfupdate| will refuse to update if the capability would be discarded.
|
`selfupdate` will refuse to update if the capability would be discarded.
|
||||||
|
|
||||||
Note: Windows forbids deletion of a currently running executable so this
|
Note: Windows forbids deletion of a currently running executable so this
|
||||||
command will rename the old executable to 'rclone.old.exe' upon success.
|
command will rename the old executable to 'rclone.old.exe' upon success.
|
||||||
|
|
||||||
Please note that this command was not available before rclone version 1.55.
|
Please note that this command was not available before rclone version 1.55.
|
||||||
If it fails for you with the message |unknown command "selfupdate"| then
|
If it fails for you with the message `unknown command "selfupdate"` then
|
||||||
you will need to update manually following the install instructions located
|
you will need to update manually following the install instructions located
|
||||||
at https://rclone.org/install/
|
at https://rclone.org/install/
|
||||||
`
|
|
|
@ -3,8 +3,8 @@ package docker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
_ "embed"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -30,6 +30,9 @@ var (
|
||||||
noSpec = false
|
noSpec = false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:embed docker.md
|
||||||
|
var longHelp string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
cmdFlags := Command.Flags()
|
cmdFlags := Command.Flags()
|
||||||
// Add command specific flags
|
// Add command specific flags
|
||||||
|
@ -47,7 +50,7 @@ func init() {
|
||||||
var Command = &cobra.Command{
|
var Command = &cobra.Command{
|
||||||
Use: "docker",
|
Use: "docker",
|
||||||
Short: `Serve any remote on docker's volume plugin API.`,
|
Short: `Serve any remote on docker's volume plugin API.`,
|
||||||
Long: strings.ReplaceAll(longHelp, "|", "`") + vfs.Help,
|
Long: longHelp + vfs.Help,
|
||||||
Annotations: map[string]string{
|
Annotations: map[string]string{
|
||||||
"versionIntroduced": "v1.56",
|
"versionIntroduced": "v1.56",
|
||||||
"groups": "Filter",
|
"groups": "Filter",
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
package docker
|
|
||||||
|
|
||||||
// Note: "|" will be replaced by backticks
|
|
||||||
var longHelp = `
|
|
||||||
This command implements the Docker volume plugin API allowing docker to use
|
This command implements the Docker volume plugin API allowing docker to use
|
||||||
rclone as a data storage mechanism for various cloud providers.
|
rclone as a data storage mechanism for various cloud providers.
|
||||||
rclone provides [docker volume plugin](/docker) based on it.
|
rclone provides [docker volume plugin](/docker) based on it.
|
||||||
|
@ -12,32 +8,31 @@ docker daemon and runs the corresponding code when necessary.
|
||||||
Docker plugins can run as a managed plugin under control of the docker daemon
|
Docker plugins can run as a managed plugin under control of the docker daemon
|
||||||
or as an independent native service. For testing, you can just run it directly
|
or as an independent native service. For testing, you can just run it directly
|
||||||
from the command line, for example:
|
from the command line, for example:
|
||||||
|||
|
```
|
||||||
sudo rclone serve docker --base-dir /tmp/rclone-volumes --socket-addr localhost:8787 -vv
|
sudo rclone serve docker --base-dir /tmp/rclone-volumes --socket-addr localhost:8787 -vv
|
||||||
|||
|
```
|
||||||
|
|
||||||
Running |rclone serve docker| will create the said socket, listening for
|
Running `rclone serve docker` will create the said socket, listening for
|
||||||
commands from Docker to create the necessary Volumes. Normally you need not
|
commands from Docker to create the necessary Volumes. Normally you need not
|
||||||
give the |--socket-addr| flag. The API will listen on the unix domain socket
|
give the `--socket-addr` flag. The API will listen on the unix domain socket
|
||||||
at |/run/docker/plugins/rclone.sock|. In the example above rclone will create
|
at `/run/docker/plugins/rclone.sock`. In the example above rclone will create
|
||||||
a TCP socket and a small file |/etc/docker/plugins/rclone.spec| containing
|
a TCP socket and a small file `/etc/docker/plugins/rclone.spec` containing
|
||||||
the socket address. We use |sudo| because both paths are writeable only by
|
the socket address. We use `sudo` because both paths are writeable only by
|
||||||
the root user.
|
the root user.
|
||||||
|
|
||||||
If you later decide to change listening socket, the docker daemon must be
|
If you later decide to change listening socket, the docker daemon must be
|
||||||
restarted to reconnect to |/run/docker/plugins/rclone.sock|
|
restarted to reconnect to `/run/docker/plugins/rclone.sock`
|
||||||
or parse new |/etc/docker/plugins/rclone.spec|. Until you restart, any
|
or parse new `/etc/docker/plugins/rclone.spec`. Until you restart, any
|
||||||
volume related docker commands will timeout trying to access the old socket.
|
volume related docker commands will timeout trying to access the old socket.
|
||||||
Running directly is supported on **Linux only**, not on Windows or MacOS.
|
Running directly is supported on **Linux only**, not on Windows or MacOS.
|
||||||
This is not a problem with managed plugin mode described in details
|
This is not a problem with managed plugin mode described in details
|
||||||
in the [full documentation](https://rclone.org/docker).
|
in the [full documentation](https://rclone.org/docker).
|
||||||
|
|
||||||
The command will create volume mounts under the path given by |--base-dir|
|
The command will create volume mounts under the path given by `--base-dir`
|
||||||
(by default |/var/lib/docker-volumes/rclone| available only to root)
|
(by default `/var/lib/docker-volumes/rclone` available only to root)
|
||||||
and maintain the JSON formatted file |docker-plugin.state| in the rclone cache
|
and maintain the JSON formatted file `docker-plugin.state` in the rclone cache
|
||||||
directory with book-keeping records of created and mounted volumes.
|
directory with book-keeping records of created and mounted volumes.
|
||||||
|
|
||||||
All mount and VFS options are submitted by the docker daemon via API, but
|
All mount and VFS options are submitted by the docker daemon via API, but
|
||||||
you can also provide defaults on the command line as well as set path to the
|
you can also provide defaults on the command line as well as set path to the
|
||||||
config file and cache directory or adjust logging verbosity.
|
config file and cache directory or adjust logging verbosity.
|
||||||
`
|
|
|
@ -22,6 +22,7 @@ package vfs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
_ "embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
@ -42,6 +43,11 @@ import (
|
||||||
"github.com/rclone/rclone/vfs/vfscommon"
|
"github.com/rclone/rclone/vfs/vfscommon"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Help for the VFS.
|
||||||
|
//
|
||||||
|
//go:embed vfs.md
|
||||||
|
var Help string
|
||||||
|
|
||||||
// Node represents either a directory (*Dir) or a file (*File)
|
// Node represents either a directory (*Dir) or a file (*File)
|
||||||
type Node interface {
|
type Node interface {
|
||||||
os.FileInfo
|
os.FileInfo
|
||||||
|
|
|
@ -1,15 +1,3 @@
|
||||||
package vfs
|
|
||||||
|
|
||||||
import (
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Help contains text describing file and directory caching to add to
|
|
||||||
// the command help.
|
|
||||||
// Warning: "!" (sic) will be replaced by backticks below,
|
|
||||||
//
|
|
||||||
// but the pipe character "|" can be used as is.
|
|
||||||
var Help = strings.ReplaceAll(`
|
|
||||||
### VFS - Virtual File System
|
### VFS - Virtual File System
|
||||||
|
|
||||||
This command uses the VFS layer. This adapts the cloud storage objects
|
This command uses the VFS layer. This adapts the cloud storage objects
|
||||||
|
@ -26,7 +14,7 @@ about files and directories (but not the data) in memory.
|
||||||
|
|
||||||
### VFS Directory Cache
|
### VFS Directory Cache
|
||||||
|
|
||||||
Using the !--dir-cache-time! flag, you can control how long a
|
Using the `--dir-cache-time` flag, you can control how long a
|
||||||
directory should be considered up to date and not refreshed from the
|
directory should be considered up to date and not refreshed from the
|
||||||
backend. Changes made through the VFS will appear immediately or
|
backend. Changes made through the VFS will appear immediately or
|
||||||
invalidate the cache.
|
invalidate the cache.
|
||||||
|
@ -40,7 +28,7 @@ the directory cache expires if the backend configured does not support
|
||||||
polling for changes. If the backend supports polling, changes will be
|
polling for changes. If the backend supports polling, changes will be
|
||||||
picked up within the polling interval.
|
picked up within the polling interval.
|
||||||
|
|
||||||
You can send a !SIGHUP! signal to rclone for it to flush all
|
You can send a `SIGHUP` signal to rclone for it to flush all
|
||||||
directory caches, regardless of how old they are. Assuming only one
|
directory caches, regardless of how old they are. Assuming only one
|
||||||
rclone instance is running, you can reset the cache like this:
|
rclone instance is running, you can reset the cache like this:
|
||||||
|
|
||||||
|
@ -57,7 +45,7 @@ Or individual files or directories:
|
||||||
|
|
||||||
### VFS File Buffering
|
### VFS File Buffering
|
||||||
|
|
||||||
The !--buffer-size! flag determines the amount of memory,
|
The `--buffer-size` flag determines the amount of memory,
|
||||||
that will be used to buffer data in advance.
|
that will be used to buffer data in advance.
|
||||||
|
|
||||||
Each open file will try to keep the specified amount of data in memory
|
Each open file will try to keep the specified amount of data in memory
|
||||||
|
@ -70,7 +58,7 @@ yet read. If the buffer is empty, only a small amount of memory will
|
||||||
be used.
|
be used.
|
||||||
|
|
||||||
The maximum memory used by rclone for buffering can be up to
|
The maximum memory used by rclone for buffering can be up to
|
||||||
!--buffer-size * open files!.
|
`--buffer-size * open files`.
|
||||||
|
|
||||||
### VFS File Caching
|
### VFS File Caching
|
||||||
|
|
||||||
|
@ -92,32 +80,32 @@ find that you need one or the other or both.
|
||||||
--vfs-cache-poll-interval duration Interval to poll the cache for stale objects (default 1m0s)
|
--vfs-cache-poll-interval duration Interval to poll the cache for stale objects (default 1m0s)
|
||||||
--vfs-write-back duration Time to writeback files after last use when using cache (default 5s)
|
--vfs-write-back duration Time to writeback files after last use when using cache (default 5s)
|
||||||
|
|
||||||
If run with !-vv! rclone will print the location of the file cache. The
|
If run with `-vv` rclone will print the location of the file cache. The
|
||||||
files are stored in the user cache file area which is OS dependent but
|
files are stored in the user cache file area which is OS dependent but
|
||||||
can be controlled with !--cache-dir! or setting the appropriate
|
can be controlled with `--cache-dir` or setting the appropriate
|
||||||
environment variable.
|
environment variable.
|
||||||
|
|
||||||
The cache has 4 different modes selected by !--vfs-cache-mode!.
|
The cache has 4 different modes selected by `--vfs-cache-mode`.
|
||||||
The higher the cache mode the more compatible rclone becomes at the
|
The higher the cache mode the more compatible rclone becomes at the
|
||||||
cost of using disk space.
|
cost of using disk space.
|
||||||
|
|
||||||
Note that files are written back to the remote only when they are
|
Note that files are written back to the remote only when they are
|
||||||
closed and if they haven't been accessed for !--vfs-write-back!
|
closed and if they haven't been accessed for `--vfs-write-back`
|
||||||
seconds. If rclone is quit or dies with files that haven't been
|
seconds. If rclone is quit or dies with files that haven't been
|
||||||
uploaded, these will be uploaded next time rclone is run with the same
|
uploaded, these will be uploaded next time rclone is run with the same
|
||||||
flags.
|
flags.
|
||||||
|
|
||||||
If using !--vfs-cache-max-size! or !--vfs-cache-min-free-size! note
|
If using `--vfs-cache-max-size` or `--vfs-cache-min-free-size` note
|
||||||
that the cache may exceed these quotas for two reasons. Firstly
|
that the cache may exceed these quotas for two reasons. Firstly
|
||||||
because it is only checked every !--vfs-cache-poll-interval!. Secondly
|
because it is only checked every `--vfs-cache-poll-interval`. Secondly
|
||||||
because open files cannot be evicted from the cache. When
|
because open files cannot be evicted from the cache. When
|
||||||
!--vfs-cache-max-size! or !--vfs-cache-min-free-size! is exceeded,
|
`--vfs-cache-max-size` or `--vfs-cache-min-free-size` is exceeded,
|
||||||
rclone will attempt to evict the least accessed files from the cache
|
rclone will attempt to evict the least accessed files from the cache
|
||||||
first. rclone will start with files that haven't been accessed for the
|
first. rclone will start with files that haven't been accessed for the
|
||||||
longest. This cache flushing strategy is efficient and more relevant
|
longest. This cache flushing strategy is efficient and more relevant
|
||||||
files are likely to remain cached.
|
files are likely to remain cached.
|
||||||
|
|
||||||
The !--vfs-cache-max-age! will evict files from the cache
|
The `--vfs-cache-max-age` will evict files from the cache
|
||||||
after the set time since last access has passed. The default value of
|
after the set time since last access has passed. The default value of
|
||||||
1 hour will start evicting files from cache that haven't been accessed
|
1 hour will start evicting files from cache that haven't been accessed
|
||||||
for 1 hour. When a cached file is accessed the 1 hour timer is reset to 0
|
for 1 hour. When a cached file is accessed the 1 hour timer is reset to 0
|
||||||
|
@ -125,10 +113,10 @@ and will wait for 1 more hour before evicting. Specify the time with
|
||||||
standard notation, s, m, h, d, w .
|
standard notation, s, m, h, d, w .
|
||||||
|
|
||||||
You **should not** run two copies of rclone using the same VFS cache
|
You **should not** run two copies of rclone using the same VFS cache
|
||||||
with the same or overlapping remotes if using !--vfs-cache-mode > off!.
|
with the same or overlapping remotes if using `--vfs-cache-mode > off`.
|
||||||
This can potentially cause data corruption if you do. You can work
|
This can potentially cause data corruption if you do. You can work
|
||||||
around this by giving each rclone its own cache hierarchy with
|
around this by giving each rclone its own cache hierarchy with
|
||||||
!--cache-dir!. You don't need to worry about this if the remotes in
|
`--cache-dir`. You don't need to worry about this if the remotes in
|
||||||
use don't overlap.
|
use don't overlap.
|
||||||
|
|
||||||
#### --vfs-cache-mode off
|
#### --vfs-cache-mode off
|
||||||
|
@ -184,14 +172,14 @@ their full size in the cache, but they will be sparse files with only
|
||||||
the data that has been downloaded present in them.
|
the data that has been downloaded present in them.
|
||||||
|
|
||||||
This mode should support all normal file system operations and is
|
This mode should support all normal file system operations and is
|
||||||
otherwise identical to !--vfs-cache-mode! writes.
|
otherwise identical to `--vfs-cache-mode` writes.
|
||||||
|
|
||||||
When reading a file rclone will read !--buffer-size! plus
|
When reading a file rclone will read `--buffer-size` plus
|
||||||
!--vfs-read-ahead! bytes ahead. The !--buffer-size! is buffered in memory
|
`--vfs-read-ahead` bytes ahead. The `--buffer-size` is buffered in memory
|
||||||
whereas the !--vfs-read-ahead! is buffered on disk.
|
whereas the `--vfs-read-ahead` is buffered on disk.
|
||||||
|
|
||||||
When using this mode it is recommended that !--buffer-size! is not set
|
When using this mode it is recommended that `--buffer-size` is not set
|
||||||
too large and !--vfs-read-ahead! is set large if required.
|
too large and `--vfs-read-ahead` is set large if required.
|
||||||
|
|
||||||
**IMPORTANT** not all file systems support sparse files. In particular
|
**IMPORTANT** not all file systems support sparse files. In particular
|
||||||
FAT/exFAT do not. Rclone will perform very badly if the cache
|
FAT/exFAT do not. Rclone will perform very badly if the cache
|
||||||
|
@ -213,17 +201,17 @@ where available on an object.
|
||||||
On some backends some of these attributes are slow to read (they take
|
On some backends some of these attributes are slow to read (they take
|
||||||
an extra API call per object, or extra work per object).
|
an extra API call per object, or extra work per object).
|
||||||
|
|
||||||
For example !hash! is slow with the !local! and !sftp! backends as
|
For example `hash` is slow with the `local` and `sftp` backends as
|
||||||
they have to read the entire file and hash it, and !modtime! is slow
|
they have to read the entire file and hash it, and `modtime` is slow
|
||||||
with the !s3!, !swift!, !ftp! and !qinqstor! backends because they
|
with the `s3`, `swift`, `ftp` and `qinqstor` backends because they
|
||||||
need to do an extra API call to fetch it.
|
need to do an extra API call to fetch it.
|
||||||
|
|
||||||
If you use the !--vfs-fast-fingerprint! flag then rclone will not
|
If you use the `--vfs-fast-fingerprint` flag then rclone will not
|
||||||
include the slow operations in the fingerprint. This makes the
|
include the slow operations in the fingerprint. This makes the
|
||||||
fingerprinting less accurate but much faster and will improve the
|
fingerprinting less accurate but much faster and will improve the
|
||||||
opening time of cached files.
|
opening time of cached files.
|
||||||
|
|
||||||
If you are running a vfs cache over !local!, !s3! or !swift! backends
|
If you are running a vfs cache over `local`, `s3` or `swift` backends
|
||||||
then using this flag is recommended.
|
then using this flag is recommended.
|
||||||
|
|
||||||
Note that if you change the value of this flag, the fingerprints of
|
Note that if you change the value of this flag, the fingerprints of
|
||||||
|
@ -243,19 +231,19 @@ These flags control the chunking:
|
||||||
--vfs-read-chunk-size SizeSuffix Read the source objects in chunks (default 128M)
|
--vfs-read-chunk-size SizeSuffix Read the source objects in chunks (default 128M)
|
||||||
--vfs-read-chunk-size-limit SizeSuffix Max chunk doubling size (default off)
|
--vfs-read-chunk-size-limit SizeSuffix Max chunk doubling size (default off)
|
||||||
|
|
||||||
Rclone will start reading a chunk of size !--vfs-read-chunk-size!,
|
Rclone will start reading a chunk of size `--vfs-read-chunk-size`,
|
||||||
and then double the size for each read. When !--vfs-read-chunk-size-limit! is
|
and then double the size for each read. When `--vfs-read-chunk-size-limit` is
|
||||||
specified, and greater than !--vfs-read-chunk-size!, the chunk size for each
|
specified, and greater than `--vfs-read-chunk-size`, the chunk size for each
|
||||||
open file will get doubled only until the specified value is reached. If the
|
open file will get doubled only until the specified value is reached. If the
|
||||||
value is "off", which is the default, the limit is disabled and the chunk size
|
value is "off", which is the default, the limit is disabled and the chunk size
|
||||||
will grow indefinitely.
|
will grow indefinitely.
|
||||||
|
|
||||||
With !--vfs-read-chunk-size 100M! and !--vfs-read-chunk-size-limit 0!
|
With `--vfs-read-chunk-size 100M` and `--vfs-read-chunk-size-limit 0`
|
||||||
the following parts will be downloaded: 0-100M, 100M-200M, 200M-300M, 300M-400M and so on.
|
the following parts will be downloaded: 0-100M, 100M-200M, 200M-300M, 300M-400M and so on.
|
||||||
When !--vfs-read-chunk-size-limit 500M! is specified, the result would be
|
When `--vfs-read-chunk-size-limit 500M` is specified, the result would be
|
||||||
0-100M, 100M-300M, 300M-700M, 700M-1200M, 1200M-1700M and so on.
|
0-100M, 100M-300M, 300M-700M, 700M-1200M, 1200M-1700M and so on.
|
||||||
|
|
||||||
Setting !--vfs-read-chunk-size! to !0! or "off" disables chunked reading.
|
Setting `--vfs-read-chunk-size` to `0` or "off" disables chunked reading.
|
||||||
|
|
||||||
### VFS Performance
|
### VFS Performance
|
||||||
|
|
||||||
|
@ -263,8 +251,8 @@ These flags may be used to enable/disable features of the VFS for
|
||||||
performance or other reasons. See also the [chunked reading](#vfs-chunked-reading)
|
performance or other reasons. See also the [chunked reading](#vfs-chunked-reading)
|
||||||
feature.
|
feature.
|
||||||
|
|
||||||
In particular S3 and Swift benefit hugely from the !--no-modtime! flag
|
In particular S3 and Swift benefit hugely from the `--no-modtime` flag
|
||||||
(or use !--use-server-modtime! for a slightly different effect) as each
|
(or use `--use-server-modtime` for a slightly different effect) as each
|
||||||
read of the modification time takes a transaction.
|
read of the modification time takes a transaction.
|
||||||
|
|
||||||
--no-checksum Don't compare checksums on up/download.
|
--no-checksum Don't compare checksums on up/download.
|
||||||
|
@ -280,9 +268,9 @@ on disk cache file.
|
||||||
--vfs-read-wait duration Time to wait for in-sequence read before seeking (default 20ms)
|
--vfs-read-wait duration Time to wait for in-sequence read before seeking (default 20ms)
|
||||||
--vfs-write-wait duration Time to wait for in-sequence write before giving error (default 1s)
|
--vfs-write-wait duration Time to wait for in-sequence write before giving error (default 1s)
|
||||||
|
|
||||||
When using VFS write caching (!--vfs-cache-mode! with value writes or full),
|
When using VFS write caching (`--vfs-cache-mode` with value writes or full),
|
||||||
the global flag !--transfers! can be set to adjust the number of parallel uploads of
|
the global flag `--transfers` can be set to adjust the number of parallel uploads of
|
||||||
modified files from the cache (the related global flag !--checkers! has no effect on the VFS).
|
modified files from the cache (the related global flag `--checkers` has no effect on the VFS).
|
||||||
|
|
||||||
--transfers int Number of file transfers to run in parallel (default 4)
|
--transfers int Number of file transfers to run in parallel (default 4)
|
||||||
|
|
||||||
|
@ -299,7 +287,7 @@ It is not allowed for two files in the same directory to differ only by case.
|
||||||
Usually file systems on macOS are case-insensitive. It is possible to make macOS
|
Usually file systems on macOS are case-insensitive. It is possible to make macOS
|
||||||
file systems case-sensitive but that is not the default.
|
file systems case-sensitive but that is not the default.
|
||||||
|
|
||||||
The !--vfs-case-insensitive! VFS flag controls how rclone handles these
|
The `--vfs-case-insensitive` VFS flag controls how rclone handles these
|
||||||
two cases. If its value is "false", rclone passes file names to the remote
|
two cases. If its value is "false", rclone passes file names to the remote
|
||||||
as-is. If the flag is "true" (or appears without a value on the
|
as-is. If the flag is "true" (or appears without a value on the
|
||||||
command line), rclone may perform a "fixup" as explained below.
|
command line), rclone may perform a "fixup" as explained below.
|
||||||
|
@ -331,13 +319,12 @@ It can be useful when those statistics cannot be read correctly automatically.
|
||||||
### Alternate report of used bytes
|
### Alternate report of used bytes
|
||||||
|
|
||||||
Some backends, most notably S3, do not report the amount of bytes used.
|
Some backends, most notably S3, do not report the amount of bytes used.
|
||||||
If you need this information to be available when running !df! on the
|
If you need this information to be available when running `df` on the
|
||||||
filesystem, then pass the flag !--vfs-used-is-size! to rclone.
|
filesystem, then pass the flag `--vfs-used-is-size` to rclone.
|
||||||
With this flag set, instead of relying on the backend to report this
|
With this flag set, instead of relying on the backend to report this
|
||||||
information, rclone will scan the whole remote similar to !rclone size!
|
information, rclone will scan the whole remote similar to `rclone size`
|
||||||
and compute the total used space itself.
|
and compute the total used space itself.
|
||||||
|
|
||||||
_WARNING._ Contrary to !rclone size!, this flag ignores filters so that the
|
_WARNING._ Contrary to `rclone size`, this flag ignores filters so that the
|
||||||
result is accurate. However, this is very inefficient and may cost lots of API
|
result is accurate. However, this is very inefficient and may cost lots of API
|
||||||
calls resulting in extra charges. Use it as a last resort and only with caching.
|
calls resulting in extra charges. Use it as a last resort and only with caching.
|
||||||
`, "!", "`")
|
|
Loading…
Reference in New Issue
Block a user