Rclone挂载Webdav作为本地磁盘

打印 上一主题 下一主题

主题 906|帖子 906|积分 2718

Rclone挂载Webdav作为本地磁盘

   本文大部门内容来自Rclone官网挂载部门手册

参考

https://www.bilibili.com/read/cv21803909/

https://www.bilibili.com/read/cv26300078/

https://www.bilibili.com/read/cv35177013/

https://www.bilibili.com/read/cv13661426/

  本文旨在用Rclone代替Raidrive与CloudDrive,在Windows情况下挂载Webdav为本地硬盘的使用场景
1 Rclone下载

下载Rclone需要前往github
下载
点击最右侧的Releases进入发行版页面,Windows用户下载带有Windows-amd64的即可
1.1 WinFSP下载

Windows用户需要再安装WinFSP作为支持,同为github
下载
与上同理,WinFSP需要下载msi后缀文件
2 安装

Rclone在Windows情况下为压缩包,在某一文件夹解压
WinFSP直接安装即可
3 Rclone导入服务器

在rclone.exe应用程序地点文件夹右键,选择在终端中打开
输入
  1. .\rclone.exe config
复制代码
进入服务器的设置界面
  1. Current remotes:
  2. Name                 Type
  3. ====                 ====
  4. webdav               webdav
  5. e) Edit existing remote       #修改服务器设置
  6. n) New remote                 #新设置
  7. d) Delete remote              #删除设置
  8. r) Rename remote              #重命名设置
  9. c) Copy remote                #复制设置
  10. s) Set configuration password #设置配置设置密码
  11. q) Quit config                #退出设置
  12. e/n/d/r/c/s/q>
复制代码
全设置参考
  1. Current remotes:
  2. Name                 Type
  3. ====                 ====
  4. webdav            webdav
  5. e) Edit existing remote
  6. n) New remote
  7. d) Delete remote
  8. r) Rename remote
  9. c) Copy remote
  10. s) Set configuration password
  11. q) Quit config
  12. e/n/d/r/c/s/q> n
  13. # 输入n 选择新创建设置
  14. Enter name for new remote.
  15. name> webdav
  16. # 输入新设置的名称
  17. Option Storage.
  18. Type of storage to configure.
  19. Choose a number from below, or type in your own value.
  20. 1 / 1Fichier
  21.    \ (fichier)
  22. 2 / Akamai NetStorage
  23.    \ (netstorage)
  24. 3 / Alias for an existing remote
  25.    \ (alias)
  26. 4 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, ArvanCloud, Ceph, ChinaMobile, Cloudflare, DigitalOcean, Dreamhost, GCS, HuaweiOBS, IBMCOS, IDrive, IONOS, LyveCloud, Leviia, Liara, Linode, Magalu, Minio, Netease, Petabox, RackCorp, Rclone, Scaleway, SeaweedFS, StackPath, Storj, Synology, TencentCOS, Wasabi, Qiniu and others
  27.    \ (s3)
  28. 5 / Backblaze B2
  29.    \ (b2)
  30. 6 / Better checksums for other remotes
  31.    \ (hasher)
  32. 7 / Box
  33.    \ (box)
  34. 8 / Cache a remote
  35.    \ (cache)
  36. 9 / Citrix Sharefile
  37.    \ (sharefile)
  38. 10 / Combine several remotes into one
  39.    \ (combine)
  40. 11 / Compress a remote
  41.    \ (compress)
  42. 12 / Dropbox
  43.    \ (dropbox)
  44. 13 / Encrypt/Decrypt a remote
  45.    \ (crypt)
  46. 14 / Enterprise File Fabric
  47.    \ (filefabric)
  48. 15 / FTP
  49.    \ (ftp)
  50. 16 / Google Cloud Storage (this is not Google Drive)
  51.    \ (google cloud storage)
  52. 17 / Google Drive
  53.    \ (drive)
  54. 18 / Google Photos
  55.    \ (google photos)
  56. 19 / HTTP
  57.    \ (http)
  58. 20 / Hadoop distributed file system
  59.    \ (hdfs)
  60. 21 / HiDrive
  61.    \ (hidrive)
  62. 22 / ImageKit.io
  63.    \ (imagekit)
  64. 23 / In memory object storage system.
  65.    \ (memory)
  66. 24 / Internet Archive
  67.    \ (internetarchive)
  68. 25 / Jottacloud
  69.    \ (jottacloud)
  70. 26 / Koofr, Digi Storage and other Koofr-compatible storage providers
  71.    \ (koofr)
  72. 27 / Linkbox
  73.    \ (linkbox)
  74. 28 / Local Disk
  75.    \ (local)
  76. 29 / Mail.ru Cloud
  77.    \ (mailru)
  78. 30 / Mega
  79.    \ (mega)
  80. 31 / Microsoft Azure Blob Storage
  81.    \ (azureblob)
  82. 32 / Microsoft Azure Files
  83.    \ (azurefiles)
  84. 33 / Microsoft OneDrive
  85.    \ (onedrive)
  86. 34 / OpenDrive
  87.    \ (opendrive)
  88. 35 / OpenStack Swift (Rackspace Cloud Files, Blomp Cloud Storage, Memset Memstore, OVH)
  89.    \ (swift)
  90. 36 / Oracle Cloud Infrastructure Object Storage
  91.    \ (oracleobjectstorage)
  92. 37 / Pcloud
  93.    \ (pcloud)
  94. 38 / PikPak
  95.    \ (pikpak)
  96. 39 / Proton Drive
  97.    \ (protondrive)
  98. 40 / Put.io
  99.    \ (putio)
  100. 41 / QingCloud Object Storage
  101.    \ (qingstor)
  102. 42 / Quatrix by Maytech
  103.    \ (quatrix)
  104. 43 / SMB / CIFS
  105.    \ (smb)
  106. 44 / SSH/SFTP
  107.    \ (sftp)
  108. 45 / Sia Decentralized Cloud
  109.    \ (sia)
  110. 46 / Storj Decentralized Cloud Storage
  111.    \ (storj)
  112. 47 / Sugarsync
  113.    \ (sugarsync)
  114. 48 / Transparently chunk/split large files
  115.    \ (chunker)
  116. 49 / Uloz.to
  117.    \ (ulozto)
  118. 50 / Union merges the contents of several upstream fs
  119.    \ (union)
  120. 51 / Uptobox
  121.    \ (uptobox)
  122. 52 / WebDAV
  123.    \ (webdav)
  124. 53 / Yandex Disk
  125.    \ (yandex)
  126. 54 / Zoho
  127.    \ (zoho)
  128. 55 / premiumize.me
  129.    \ (premiumizeme)
  130. 56 / seafile
  131.    \ (seafile)
  132. Storage> 52
  133. # 选择webdav对应的编号 我这边为52 需要根据你实际编号选择
  134. Option url.
  135. URL of http host to connect to.
  136. E.g. https://example.com.
  137. Enter a value.
  138. url> http://192.168.1.1:8800
  139. # 输入你Webdav服务器对应的链接与端口
  140. Option vendor.
  141. Name of the WebDAV site/service/software you are using.
  142. Choose a number from below, or type in your own value.
  143. Press Enter to leave empty.
  144. 1 / Fastmail Files
  145.    \ (fastmail)
  146. 2 / Nextcloud
  147.    \ (nextcloud)
  148. 3 / Owncloud
  149.    \ (owncloud)
  150. 4 / Sharepoint Online, authenticated by Microsoft account
  151.    \ (sharepoint)
  152. 5 / Sharepoint with NTLM authentication, usually self-hosted or on-premises
  153.    \ (sharepoint-ntlm)
  154. 6 / rclone WebDAV server to serve a remote over HTTP via the WebDAV protocol
  155.    \ (rclone)
  156. 7 / Other site/service or software
  157.    \ (other)
  158. vendor> 7
  159. # Rclone提供了几种常用的Webdav设置 我为自己搭建 选择7(other)
  160. Option user.
  161. User name.
  162. In case NTLM authentication is used, the username should be in the format 'Domain\User'.
  163. Enter a value. Press Enter to leave empty.
  164. user> DAV_user
  165. # 输入Webdav用户名
  166. Option pass.
  167. Password.
  168. Choose an alternative below. Press Enter for the default (n).
  169. y) Yes, type in my own password
  170. g) Generate random password
  171. n) No, leave this optional password blank (default)
  172. y/g/n> y
  173. # 需要密码 选择y
  174. Enter the password:
  175. password:
  176. Confirm the password:
  177. password:
  178. # 输入密码时不会显示密码
  179. Option bearer_token.
  180. Bearer token instead of user/pass (e.g. a Macaroon).
  181. Enter a value. Press Enter to leave empty.
  182. bearer_token>
  183. # 没有设置令牌按回车留空
  184. Edit advanced config?
  185. y) Yes
  186. n) No (default)
  187. y/n> n
  188. # 开启高级设置 这边并不需要 选择n
  189. #确认你的设置是否有错误
  190. Configuration complete.
  191. Options:
  192. - type: webdav
  193. - url: http://192.168.1.30:8800
  194. - vendor: other
  195. - user: DAV_user
  196. - pass: *** ENCRYPTED ***
  197. Keep this "webdav" remote?
  198. y) Yes this is OK (default)
  199. e) Edit this remote
  200. d) Delete this remote
  201. y/e/d> y
  202. # 确认无误
  203. Current remotes:
  204. Name                 Type
  205. ====                 ====
  206. webdav               webdav
  207. e) Edit existing remote
  208. n) New remote
  209. d) Delete remote
  210. r) Rename remote
  211. c) Copy remote
  212. s) Set configuration password
  213. q) Quit config
  214. e/n/d/r/c/s/q>q
  215. # 可以看到自己的设置了 退出
复制代码
4 Rclone挂载

设置完服务器后,便可以使用Rclone举行挂载了
在Rclone地点文件夹打开下令行,输入
  1. .\rclone.exe mount webdav:/ W: --vfs-cache-mode writes --cache-dir ./cache --log-level INFO --progress --file-perms 0777
复制代码
下面分开解释下令意义
  1. .\rclone.exe
  2. 指代当前文件夹下的rclone.exe文件
复制代码
  1. mount
  2. 挂载命令
复制代码
  1. webdav:/ W:
  2. webdav指的是你设置的名称 :/表示挂载的远程文件夹 W:指挂载在电脑上的盘符
复制代码
  1. --vfs-cache-mode writes
  2. vfs虚拟文件系统 缓存模式 写入
  3. Rclone存在4种缓存模式:off|minimal|writes|full
  4. 缓存模式越高,rclone 的兼容性就越好,但会占用更多的磁盘空间
  5. 如果你的网速够快可以考虑选择off 关闭缓存
复制代码
  1. --cache-dir ./cache
  2. 缓存目录 这里./cache指 在本文件夹下的cache文件夹中
复制代码
  1. --log-level INFO --progress
  2. 让命令行输入INFO类型的日志 同时显示上传或下载的进度条
复制代码
  1. --file-perms 0777
  2. 更改文件权限 设置为全部权限(UNIX格式)
  3. 默认的权限为0666,即不包含运行权限
  4. 如果你不需要在挂载中运行exe程序可以忽略该行
复制代码
5 设置Rclone开机启动

   注意修改下文中所有下令的对应名称,并确认你是否需要以下功能

    D:\Rclone\rclone.exe

rclone.exe文件地点的文件路径
    webdav:/ W:

webdav:设置的名称 W:挂载的本职位置
    –vfs-cache-mode writes

缓存方式,一般发起为writes
    –file-perms 0777

文件权限设置 不需要运行exe文件可以忽略
  5.1 有下令行窗口实现方法

   但由于此方式仍有下令行常驻桌面,5.2有用vbs来实现隐蔽下令行的结果
  此设置开机启动方式为设置bat文件
新建txt文本,放入以下内容
  1. D:\Rclone\rclone.exe mount webdav:/ W: --vfs-cache-mode off --file-perms 0777
复制代码
将txt文本后缀改为bat
将bat文件放入Windows的启动目录中C:\%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
5.2 隐蔽下令行窗口实现方法

此设置开机启动方式为设置bat文件,用vbs文件打开bat文件隐蔽下令行窗口
新建txt文本,放入以下内容
  1. D:\Rclone\rclone.exe mount webdav:/ W: --vfs-cache-mode off --file-perms 0777
复制代码
将txt文本后缀改为bat
新建txt文本,放入以下内容
  1. CreateObject("WScript.Shell").Run "cmd /c D:\Rclone/rclone.bat",0
复制代码
将txt文本后缀改为vbs
将vbs文件放入Windows的启动目录中C:\%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
6 Rclone额外常用下令

   下面内容未颠末笔者测试,内容来自于官网手册

仅作部门翻译
  假如需要rclone自己分配可用盘符
  1. .\rclone.exe mount webdav:/ *
  2. 将盘符改为" * "
  3. Rclone也可挂载到文件夹中,修改参数可实现
复制代码
挂载为网络驱动器
  1. --network-mode
复制代码
修改Windows文件夹访问权限
  1. ---dir-perms 0777
复制代码
VFS目录缓存
  1. --dir-cache-time duration   缓存目录条目时间 (默认为 5m0s)
  2. --poll-interval duration    在轮询更改之间的等待时间 需要小于上面一条的时间 设置为0禁用 (默认为 1m0s)
复制代码
VFS文件缓冲
  1. --buffer-size
  2. 此标志是每个打开文件所用内存的上限。缓冲区将只使用内存来存储已下载但尚未读取的数据。如果缓冲区为空,则只会使用少量内存。
复制代码
VFS文件缓存
  1. --cache-dir string                     缓存目录
  2. --vfs-cache-mode CacheMode             Cache mode off|minimal|writes|full (默认 off)
  3. --vfs-cache-max-age duration           自上次访问缓存中的对象以来的最大时间 (默认 1h0m0s)
  4. --vfs-cache-max-size SizeSuffix        缓存中对象的最大总大小 (默认 off)
  5. --vfs-cache-min-free-space SizeSuffix  在包含缓存的磁盘上设定最小可用空间的目标 (默认 off)
  6. --vfs-cache-poll-interval duration     轮询缓存以查找过时对象的时间间隔 (默认 1m0s)
  7. --vfs-write-back duration              使用缓存时最后一次使用后写回文件的时间 (默认 5s)
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

用户云卷云舒

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表