1package vfs 2 3import ( 4 "strings" 5) 6 7// Help contains text describing file and directory caching to add to 8// the command help. 9// Warning: "!" (sic) will be replaced by backticks below, 10// but the pipe character "|" can be used as is. 11var Help = strings.ReplaceAll(` 12### VFS - Virtual File System 13 14This command uses the VFS layer. This adapts the cloud storage objects 15that rclone uses into something which looks much more like a disk 16filing system. 17 18Cloud storage objects have lots of properties which aren't like disk 19files - you can't extend them or write to the middle of them, so the 20VFS layer has to deal with that. Because there is no one right way of 21doing this there are various options explained below. 22 23The VFS layer also implements a directory cache - this caches info 24about files and directories (but not the data) in memory. 25 26### VFS Directory Cache 27 28Using the !--dir-cache-time! flag, you can control how long a 29directory should be considered up to date and not refreshed from the 30backend. Changes made through the mount will appear immediately or 31invalidate the cache. 32 33 --dir-cache-time duration Time to cache directory entries for (default 5m0s) 34 --poll-interval duration Time to wait between polling for changes. Must be smaller than dir-cache-time. Only on supported remotes. Set to 0 to disable (default 1m0s) 35 36However, changes made directly on the cloud storage by the web 37interface or a different copy of rclone will only be picked up once 38the directory cache expires if the backend configured does not support 39polling for changes. If the backend supports polling, changes will be 40picked up within the polling interval. 41 42You can send a !SIGHUP! signal to rclone for it to flush all 43directory caches, regardless of how old they are. Assuming only one 44rclone instance is running, you can reset the cache like this: 45 46 kill -SIGHUP $(pidof rclone) 47 48If you configure rclone with a [remote control](/rc) then you can use 49rclone rc to flush the whole directory cache: 50 51 rclone rc vfs/forget 52 53Or individual files or directories: 54 55 rclone rc vfs/forget file=path/to/file dir=path/to/dir 56 57### VFS File Buffering 58 59The !--buffer-size! flag determines the amount of memory, 60that will be used to buffer data in advance. 61 62Each open file will try to keep the specified amount of data in memory 63at all times. The buffered data is bound to one open file and won't be 64shared. 65 66This flag is a upper limit for the used memory per open file. The 67buffer will only use memory for data that is downloaded but not not 68yet read. If the buffer is empty, only a small amount of memory will 69be used. 70 71The maximum memory used by rclone for buffering can be up to 72!--buffer-size * open files!. 73 74### VFS File Caching 75 76These flags control the VFS file caching options. File caching is 77necessary to make the VFS layer appear compatible with a normal file 78system. It can be disabled at the cost of some compatibility. 79 80For example you'll need to enable VFS caching if you want to read and 81write simultaneously to a file. See below for more details. 82 83Note that the VFS cache is separate from the cache backend and you may 84find that you need one or the other or both. 85 86 --cache-dir string Directory rclone will use for caching. 87 --vfs-cache-mode CacheMode Cache mode off|minimal|writes|full (default off) 88 --vfs-cache-max-age duration Max age of objects in the cache (default 1h0m0s) 89 --vfs-cache-max-size SizeSuffix Max total size of objects in the cache (default off) 90 --vfs-cache-poll-interval duration Interval to poll the cache for stale objects (default 1m0s) 91 --vfs-write-back duration Time to writeback files after last use when using cache (default 5s) 92 93If run with !-vv! rclone will print the location of the file cache. The 94files are stored in the user cache file area which is OS dependent but 95can be controlled with !--cache-dir! or setting the appropriate 96environment variable. 97 98The cache has 4 different modes selected by !--vfs-cache-mode!. 99The higher the cache mode the more compatible rclone becomes at the 100cost of using disk space. 101 102Note that files are written back to the remote only when they are 103closed and if they haven't been accessed for !--vfs-write-back! 104seconds. If rclone is quit or dies with files that haven't been 105uploaded, these will be uploaded next time rclone is run with the same 106flags. 107 108If using !--vfs-cache-max-size! note that the cache may exceed this size 109for two reasons. Firstly because it is only checked every 110!--vfs-cache-poll-interval!. Secondly because open files cannot be 111evicted from the cache. 112 113You **should not** run two copies of rclone using the same VFS cache 114with the same or overlapping remotes if using !--vfs-cache-mode > off!. 115This can potentially cause data corruption if you do. You can work 116around this by giving each rclone its own cache hierarchy with 117!--cache-dir!. You don't need to worry about this if the remotes in 118use don't overlap. 119 120#### --vfs-cache-mode off 121 122In this mode (the default) the cache will read directly from the remote and write 123directly to the remote without caching anything on disk. 124 125This will mean some operations are not possible 126 127 * Files can't be opened for both read AND write 128 * Files opened for write can't be seeked 129 * Existing files opened for write must have O_TRUNC set 130 * Files open for read with O_TRUNC will be opened write only 131 * Files open for write only will behave as if O_TRUNC was supplied 132 * Open modes O_APPEND, O_TRUNC are ignored 133 * If an upload fails it can't be retried 134 135#### --vfs-cache-mode minimal 136 137This is very similar to "off" except that files opened for read AND 138write will be buffered to disk. This means that files opened for 139write will be a lot more compatible, but uses the minimal disk space. 140 141These operations are not possible 142 143 * Files opened for write only can't be seeked 144 * Existing files opened for write must have O_TRUNC set 145 * Files opened for write only will ignore O_APPEND, O_TRUNC 146 * If an upload fails it can't be retried 147 148#### --vfs-cache-mode writes 149 150In this mode files opened for read only are still read directly from 151the remote, write only and read/write files are buffered to disk 152first. 153 154This mode should support all normal file system operations. 155 156If an upload fails it will be retried at exponentially increasing 157intervals up to 1 minute. 158 159#### --vfs-cache-mode full 160 161In this mode all reads and writes are buffered to and from disk. When 162data is read from the remote this is buffered to disk as well. 163 164In this mode the files in the cache will be sparse files and rclone 165will keep track of which bits of the files it has downloaded. 166 167So if an application only reads the starts of each file, then rclone 168will only buffer the start of the file. These files will appear to be 169their full size in the cache, but they will be sparse files with only 170the data that has been downloaded present in them. 171 172This mode should support all normal file system operations and is 173otherwise identical to !--vfs-cache-mode! writes. 174 175When reading a file rclone will read !--buffer-size! plus 176!--vfs-read-ahead! bytes ahead. The !--buffer-size! is buffered in memory 177whereas the !--vfs-read-ahead! is buffered on disk. 178 179When using this mode it is recommended that !--buffer-size! is not set 180too large and !--vfs-read-ahead! is set large if required. 181 182**IMPORTANT** not all file systems support sparse files. In particular 183FAT/exFAT do not. Rclone will perform very badly if the cache 184directory is on a filesystem which doesn't support sparse files and it 185will log an ERROR message if one is detected. 186 187### VFS Chunked Reading 188 189When rclone reads files from a remote it reads them in chunks. This 190means that rather than requesting the whole file rclone reads the 191chunk specified. This can reduce the used download quota for some 192remotes by requesting only chunks from the remote that are actually 193read, at the cost of an increased number of requests. 194 195These flags control the chunking: 196 197 --vfs-read-chunk-size SizeSuffix Read the source objects in chunks (default 128M) 198 --vfs-read-chunk-size-limit SizeSuffix Max chunk doubling size (default off) 199 200Rclone will start reading a chunk of size !--vfs-read-chunk-size!, 201and then double the size for each read. When !--vfs-read-chunk-size-limit! is 202specified, and greater than !--vfs-read-chunk-size!, the chunk size for each 203open file will get doubled only until the specified value is reached. If the 204value is "off", which is the default, the limit is disabled and the chunk size 205will grow indefinitely. 206 207With !--vfs-read-chunk-size 100M! and !--vfs-read-chunk-size-limit 0! 208the following parts will be downloaded: 0-100M, 100M-200M, 200M-300M, 300M-400M and so on. 209When !--vfs-read-chunk-size-limit 500M! is specified, the result would be 2100-100M, 100M-300M, 300M-700M, 700M-1200M, 1200M-1700M and so on. 211 212Setting !--vfs-read-chunk-size! to !0! or "off" disables chunked reading. 213 214### VFS Performance 215 216These flags may be used to enable/disable features of the VFS for 217performance or other reasons. See also the [chunked reading](#vfs-chunked-reading) 218feature. 219 220In particular S3 and Swift benefit hugely from the !--no-modtime! flag 221(or use !--use-server-modtime! for a slightly different effect) as each 222read of the modification time takes a transaction. 223 224 --no-checksum Don't compare checksums on up/download. 225 --no-modtime Don't read/write the modification time (can speed things up). 226 --no-seek Don't allow seeking in files. 227 --read-only Mount read-only. 228 229Sometimes rclone is delivered reads or writes out of order. Rather 230than seeking rclone will wait a short time for the in sequence read or 231write to come in. These flags only come into effect when not using an 232on disk cache file. 233 234 --vfs-read-wait duration Time to wait for in-sequence read before seeking (default 20ms) 235 --vfs-write-wait duration Time to wait for in-sequence write before giving error (default 1s) 236 237When using VFS write caching (!--vfs-cache-mode! with value writes or full), 238the global flag !--transfers! can be set to adjust the number of parallel uploads of 239modified files from cache (the related global flag !--checkers! have no effect on mount). 240 241 --transfers int Number of file transfers to run in parallel (default 4) 242 243### VFS Case Sensitivity 244 245Linux file systems are case-sensitive: two files can differ only 246by case, and the exact case must be used when opening a file. 247 248File systems in modern Windows are case-insensitive but case-preserving: 249although existing files can be opened using any case, the exact case used 250to create the file is preserved and available for programs to query. 251It is not allowed for two files in the same directory to differ only by case. 252 253Usually file systems on macOS are case-insensitive. It is possible to make macOS 254file systems case-sensitive but that is not the default. 255 256The !--vfs-case-insensitive! mount flag controls how rclone handles these 257two cases. If its value is "false", rclone passes file names to the mounted 258file system as-is. If the flag is "true" (or appears without a value on 259command line), rclone may perform a "fixup" as explained below. 260 261The user may specify a file name to open/delete/rename/etc with a case 262different than what is stored on mounted file system. If an argument refers 263to an existing file with exactly the same name, then the case of the existing 264file on the disk will be used. However, if a file name with exactly the same 265name is not found but a name differing only by case exists, rclone will 266transparently fixup the name. This fixup happens only when an existing file 267is requested. Case sensitivity of file names created anew by rclone is 268controlled by an underlying mounted file system. 269 270Note that case sensitivity of the operating system running rclone (the target) 271may differ from case sensitivity of a file system mounted by rclone (the source). 272The flag controls whether "fixup" is performed to satisfy the target. 273 274If the flag is not provided on the command line, then its default value depends 275on the operating system where rclone runs: "true" on Windows and macOS, "false" 276otherwise. If the flag is provided without a value, then it is "true". 277 278### Alternate report of used bytes 279 280Some backends, most notably S3, do not report the amount of bytes used. 281If you need this information to be available when running !df! on the 282filesystem, then pass the flag !--vfs-used-is-size! to rclone. 283With this flag set, instead of relying on the backend to report this 284information, rclone will scan the whole remote similar to !rclone size! 285and compute the total used space itself. 286 287_WARNING._ Contrary to !rclone size!, this flag ignores filters so that the 288result is accurate. However, this is very inefficient and may cost lots of API 289calls resulting in extra charges. Use it as a last resort and only with caching. 290`, "!", "`") 291