github.com/xhghs/rclone@v1.51.1-0.20200430155106-e186a28cced8/docs/content/commands/rclone_mount.md (about) 1 --- 2 date: 2020-02-01T10:26:53Z 3 title: "rclone mount" 4 slug: rclone_mount 5 url: /commands/rclone_mount/ 6 --- 7 ## rclone mount 8 9 Mount the remote as file system on a mountpoint. 10 11 ### Synopsis 12 13 14 rclone mount allows Linux, FreeBSD, macOS and Windows to 15 mount any of Rclone's cloud storage systems as a file system with 16 FUSE. 17 18 First set up your remote using `rclone config`. Check it works with `rclone ls` etc. 19 20 Start the mount like this 21 22 rclone mount remote:path/to/files /path/to/local/mount 23 24 Or on Windows like this where X: is an unused drive letter 25 26 rclone mount remote:path/to/files X: 27 28 When the program ends, either via Ctrl+C or receiving a SIGINT or SIGTERM signal, 29 the mount is automatically stopped. 30 31 The umount operation can fail, for example when the mountpoint is busy. 32 When that happens, it is the user's responsibility to stop the mount manually with 33 34 # Linux 35 fusermount -u /path/to/local/mount 36 # OS X 37 umount /path/to/local/mount 38 39 ### Installing on Windows 40 41 To run rclone mount on Windows, you will need to 42 download and install [WinFsp](http://www.secfs.net/winfsp/). 43 44 WinFsp is an [open source](https://github.com/billziss-gh/winfsp) 45 Windows File System Proxy which makes it easy to write user space file 46 systems for Windows. It provides a FUSE emulation layer which rclone 47 uses combination with 48 [cgofuse](https://github.com/billziss-gh/cgofuse). Both of these 49 packages are by Bill Zissimopoulos who was very helpful during the 50 implementation of rclone mount for Windows. 51 52 #### Windows caveats 53 54 Note that drives created as Administrator are not visible by other 55 accounts (including the account that was elevated as 56 Administrator). So if you start a Windows drive from an Administrative 57 Command Prompt and then try to access the same drive from Explorer 58 (which does not run as Administrator), you will not be able to see the 59 new drive. 60 61 The easiest way around this is to start the drive from a normal 62 command prompt. It is also possible to start a drive from the SYSTEM 63 account (using [the WinFsp.Launcher 64 infrastructure](https://github.com/billziss-gh/winfsp/wiki/WinFsp-Service-Architecture)) 65 which creates drives accessible for everyone on the system or 66 alternatively using [the nssm service manager](https://nssm.cc/usage). 67 68 ### Limitations 69 70 Without the use of "--vfs-cache-mode" this can only write files 71 sequentially, it can only seek when reading. This means that many 72 applications won't work with their files on an rclone mount without 73 "--vfs-cache-mode writes" or "--vfs-cache-mode full". See the [File 74 Caching](#file-caching) section for more info. 75 76 The bucket based remotes (eg Swift, S3, Google Compute Storage, B2, 77 Hubic) do not support the concept of empty directories, so empty 78 directories will have a tendency to disappear once they fall out of 79 the directory cache. 80 81 Only supported on Linux, FreeBSD, OS X and Windows at the moment. 82 83 ### rclone mount vs rclone sync/copy 84 85 File systems expect things to be 100% reliable, whereas cloud storage 86 systems are a long way from 100% reliable. The rclone sync/copy 87 commands cope with this with lots of retries. However rclone mount 88 can't use retries in the same way without making local copies of the 89 uploads. Look at the [file caching](#file-caching) 90 for solutions to make mount more reliable. 91 92 ### Attribute caching 93 94 You can use the flag --attr-timeout to set the time the kernel caches 95 the attributes (size, modification time etc) for directory entries. 96 97 The default is "1s" which caches files just long enough to avoid 98 too many callbacks to rclone from the kernel. 99 100 In theory 0s should be the correct value for filesystems which can 101 change outside the control of the kernel. However this causes quite a 102 few problems such as 103 [rclone using too much memory](https://github.com/rclone/rclone/issues/2157), 104 [rclone not serving files to samba](https://forum.rclone.org/t/rclone-1-39-vs-1-40-mount-issue/5112) 105 and [excessive time listing directories](https://github.com/rclone/rclone/issues/2095#issuecomment-371141147). 106 107 The kernel can cache the info about a file for the time given by 108 "--attr-timeout". You may see corruption if the remote file changes 109 length during this window. It will show up as either a truncated file 110 or a file with garbage on the end. With "--attr-timeout 1s" this is 111 very unlikely but not impossible. The higher you set "--attr-timeout" 112 the more likely it is. The default setting of "1s" is the lowest 113 setting which mitigates the problems above. 114 115 If you set it higher ('10s' or '1m' say) then the kernel will call 116 back to rclone less often making it more efficient, however there is 117 more chance of the corruption issue above. 118 119 If files don't change on the remote outside of the control of rclone 120 then there is no chance of corruption. 121 122 This is the same as setting the attr_timeout option in mount.fuse. 123 124 ### Filters 125 126 Note that all the rclone filters can be used to select a subset of the 127 files to be visible in the mount. 128 129 ### systemd 130 131 When running rclone mount as a systemd service, it is possible 132 to use Type=notify. In this case the service will enter the started state 133 after the mountpoint has been successfully set up. 134 Units having the rclone mount service specified as a requirement 135 will see all files and folders immediately in this mode. 136 137 ### chunked reading ### 138 139 --vfs-read-chunk-size will enable reading the source objects in parts. 140 This can reduce the used download quota for some remotes by requesting only chunks 141 from the remote that are actually read at the cost of an increased number of requests. 142 143 When --vfs-read-chunk-size-limit is also specified and greater than --vfs-read-chunk-size, 144 the chunk size for each open file will get doubled for each chunk read, until the 145 specified value is reached. A value of -1 will disable the limit and the chunk size will 146 grow indefinitely. 147 148 With --vfs-read-chunk-size 100M and --vfs-read-chunk-size-limit 0 the following 149 parts will be downloaded: 0-100M, 100M-200M, 200M-300M, 300M-400M and so on. 150 When --vfs-read-chunk-size-limit 500M is specified, the result would be 151 0-100M, 100M-300M, 300M-700M, 700M-1200M, 1200M-1700M and so on. 152 153 Chunked reading will only work with --vfs-cache-mode < full, as the file will always 154 be copied to the vfs cache before opening with --vfs-cache-mode full. 155 156 ### Directory Cache 157 158 Using the `--dir-cache-time` flag, you can set how long a 159 directory should be considered up to date and not refreshed from the 160 backend. Changes made locally in the mount may appear immediately or 161 invalidate the cache. However, changes done on the remote will only 162 be picked up once the cache expires. 163 164 Alternatively, you can send a `SIGHUP` signal to rclone for 165 it to flush all directory caches, regardless of how old they are. 166 Assuming only one rclone instance is running, you can reset the cache 167 like this: 168 169 kill -SIGHUP $(pidof rclone) 170 171 If you configure rclone with a [remote control](/rc) then you can use 172 rclone rc to flush the whole directory cache: 173 174 rclone rc vfs/forget 175 176 Or individual files or directories: 177 178 rclone rc vfs/forget file=path/to/file dir=path/to/dir 179 180 ### File Buffering 181 182 The `--buffer-size` flag determines the amount of memory, 183 that will be used to buffer data in advance. 184 185 Each open file descriptor will try to keep the specified amount of 186 data in memory at all times. The buffered data is bound to one file 187 descriptor and won't be shared between multiple open file descriptors 188 of the same file. 189 190 This flag is a upper limit for the used memory per file descriptor. 191 The buffer will only use memory for data that is downloaded but not 192 not yet read. If the buffer is empty, only a small amount of memory 193 will be used. 194 The maximum memory used by rclone for buffering can be up to 195 `--buffer-size * open files`. 196 197 ### File Caching 198 199 These flags control the VFS file caching options. The VFS layer is 200 used by rclone mount to make a cloud storage system work more like a 201 normal file system. 202 203 You'll need to enable VFS caching if you want, for example, to read 204 and write simultaneously to a file. See below for more details. 205 206 Note that the VFS cache works in addition to the cache backend and you 207 may find that you need one or the other or both. 208 209 --cache-dir string Directory rclone will use for caching. 210 --vfs-cache-max-age duration Max age of objects in the cache. (default 1h0m0s) 211 --vfs-cache-mode string Cache mode off|minimal|writes|full (default "off") 212 --vfs-cache-poll-interval duration Interval to poll the cache for stale objects. (default 1m0s) 213 --vfs-cache-max-size int Max total size of objects in the cache. (default off) 214 215 If run with `-vv` rclone will print the location of the file cache. The 216 files are stored in the user cache file area which is OS dependent but 217 can be controlled with `--cache-dir` or setting the appropriate 218 environment variable. 219 220 The cache has 4 different modes selected by `--vfs-cache-mode`. 221 The higher the cache mode the more compatible rclone becomes at the 222 cost of using disk space. 223 224 Note that files are written back to the remote only when they are 225 closed so if rclone is quit or dies with open files then these won't 226 get written back to the remote. However they will still be in the on 227 disk cache. 228 229 If using --vfs-cache-max-size note that the cache may exceed this size 230 for two reasons. Firstly because it is only checked every 231 --vfs-cache-poll-interval. Secondly because open files cannot be 232 evicted from the cache. 233 234 #### --vfs-cache-mode off 235 236 In this mode the cache will read directly from the remote and write 237 directly to the remote without caching anything on disk. 238 239 This will mean some operations are not possible 240 241 * Files can't be opened for both read AND write 242 * Files opened for write can't be seeked 243 * Existing files opened for write must have O_TRUNC set 244 * Files open for read with O_TRUNC will be opened write only 245 * Files open for write only will behave as if O_TRUNC was supplied 246 * Open modes O_APPEND, O_TRUNC are ignored 247 * If an upload fails it can't be retried 248 249 #### --vfs-cache-mode minimal 250 251 This is very similar to "off" except that files opened for read AND 252 write will be buffered to disks. This means that files opened for 253 write will be a lot more compatible, but uses the minimal disk space. 254 255 These operations are not possible 256 257 * Files opened for write only can't be seeked 258 * Existing files opened for write must have O_TRUNC set 259 * Files opened for write only will ignore O_APPEND, O_TRUNC 260 * If an upload fails it can't be retried 261 262 #### --vfs-cache-mode writes 263 264 In this mode files opened for read only are still read directly from 265 the remote, write only and read/write files are buffered to disk 266 first. 267 268 This mode should support all normal file system operations. 269 270 If an upload fails it will be retried up to --low-level-retries times. 271 272 #### --vfs-cache-mode full 273 274 In this mode all reads and writes are buffered to and from disk. When 275 a file is opened for read it will be downloaded in its entirety first. 276 277 This may be appropriate for your needs, or you may prefer to look at 278 the cache backend which does a much more sophisticated job of caching, 279 including caching directory hierarchies and chunks of files. 280 281 In this mode, unlike the others, when a file is written to the disk, 282 it will be kept on the disk after it is written to the remote. It 283 will be purged on a schedule according to `--vfs-cache-max-age`. 284 285 This mode should support all normal file system operations. 286 287 If an upload or download fails it will be retried up to 288 --low-level-retries times. 289 290 291 ``` 292 rclone mount remote:path /path/to/mountpoint [flags] 293 ``` 294 295 ### Options 296 297 ``` 298 --allow-non-empty Allow mounting over a non-empty directory. 299 --allow-other Allow access to other users. 300 --allow-root Allow access to root user. 301 --attr-timeout duration Time for which file/directory attributes are cached. (default 1s) 302 --daemon Run mount as a daemon (background mode). 303 --daemon-timeout duration Time limit for rclone to respond to kernel (not supported by all OSes). 304 --debug-fuse Debug the FUSE internals - needs -v. 305 --default-permissions Makes kernel enforce access control based on the file mode. 306 --dir-cache-time duration Time to cache directory entries for. (default 5m0s) 307 --dir-perms FileMode Directory permissions (default 0777) 308 --file-perms FileMode File permissions (default 0666) 309 --fuse-flag stringArray Flags or arguments to be passed direct to libfuse/WinFsp. Repeat if required. 310 --gid uint32 Override the gid field set by the filesystem. (default 1000) 311 -h, --help help for mount 312 --max-read-ahead SizeSuffix The number of bytes that can be prefetched for sequential reads. (default 128k) 313 --no-checksum Don't compare checksums on up/download. 314 --no-modtime Don't read/write the modification time (can speed things up). 315 --no-seek Don't allow seeking in files. 316 -o, --option stringArray Option for libfuse/WinFsp. Repeat if required. 317 --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) 318 --read-only Mount read-only. 319 --uid uint32 Override the uid field set by the filesystem. (default 1000) 320 --umask int Override the permission bits set by the filesystem. 321 --vfs-cache-max-age duration Max age of objects in the cache. (default 1h0m0s) 322 --vfs-cache-max-size SizeSuffix Max total size of objects in the cache. (default off) 323 --vfs-cache-mode CacheMode Cache mode off|minimal|writes|full (default off) 324 --vfs-cache-poll-interval duration Interval to poll the cache for stale objects. (default 1m0s) 325 --vfs-case-insensitive If a file name not found, find a case insensitive match. 326 --vfs-read-chunk-size SizeSuffix Read the source objects in chunks. (default 128M) 327 --vfs-read-chunk-size-limit SizeSuffix If greater than --vfs-read-chunk-size, double the chunk size after each chunk read, until the limit is reached. 'off' is unlimited. (default off) 328 --volname string Set the volume name (not supported by all OSes). 329 --write-back-cache Makes kernel buffer writes before sending them to rclone. Without this, writethrough caching is used. 330 ``` 331 332 See the [global flags page](/flags/) for global options not listed here. 333 334 ### SEE ALSO 335 336 * [rclone](/commands/rclone/) - Show help for rclone commands, flags and backends. 337