Rclone挂载Webdav作为本地磁盘

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应用程序所在文件夹右键,选择在终端中打开

输入

.\rclone.exe config

进入服务器的设置界面

Current remotes:

Name                 Type
====                 ====
webdav               webdav

e) Edit existing remote       #修改服务器设置
n) New remote                 #新设置
d) Delete remote              #删除设置
r) Rename remote              #重命名设置
c) Copy remote                #复制设置
s) Set configuration password #设置配置设置密码
q) Quit config                #退出设置
e/n/d/r/c/s/q>

全设置参考

Current remotes:

Name                 Type
====                 ====
webdav            webdav

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n 
# 输入n 选择新创建设置

Enter name for new remote.
name> webdav
# 输入新设置的名称

Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
 1 / 1Fichier
   \ (fichier)
 2 / Akamai NetStorage
   \ (netstorage)
 3 / Alias for an existing remote
   \ (alias)
 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
   \ (s3)
 5 / Backblaze B2
   \ (b2)
 6 / Better checksums for other remotes
   \ (hasher)
 7 / Box
   \ (box)
 8 / Cache a remote
   \ (cache)
 9 / Citrix Sharefile
   \ (sharefile)
10 / Combine several remotes into one
   \ (combine)
11 / Compress a remote
   \ (compress)
12 / Dropbox
   \ (dropbox)
13 / Encrypt/Decrypt a remote
   \ (crypt)
14 / Enterprise File Fabric
   \ (filefabric)
15 / FTP
   \ (ftp)
16 / Google Cloud Storage (this is not Google Drive)
   \ (google cloud storage)
17 / Google Drive
   \ (drive)
18 / Google Photos
   \ (google photos)
19 / HTTP
   \ (http)
20 / Hadoop distributed file system
   \ (hdfs)
21 / HiDrive
   \ (hidrive)
22 / ImageKit.io
   \ (imagekit)
23 / In memory object storage system.
   \ (memory)
24 / Internet Archive
   \ (internetarchive)
25 / Jottacloud
   \ (jottacloud)
26 / Koofr, Digi Storage and other Koofr-compatible storage providers
   \ (koofr)
27 / Linkbox
   \ (linkbox)
28 / Local Disk
   \ (local)
29 / Mail.ru Cloud
   \ (mailru)
30 / Mega
   \ (mega)
31 / Microsoft Azure Blob Storage
   \ (azureblob)
32 / Microsoft Azure Files
   \ (azurefiles)
33 / Microsoft OneDrive
   \ (onedrive)
34 / OpenDrive
   \ (opendrive)
35 / OpenStack Swift (Rackspace Cloud Files, Blomp Cloud Storage, Memset Memstore, OVH)
   \ (swift)
36 / Oracle Cloud Infrastructure Object Storage
   \ (oracleobjectstorage)
37 / Pcloud
   \ (pcloud)
38 / PikPak
   \ (pikpak)
39 / Proton Drive
   \ (protondrive)
40 / Put.io
   \ (putio)
41 / QingCloud Object Storage
   \ (qingstor)
42 / Quatrix by Maytech
   \ (quatrix)
43 / SMB / CIFS
   \ (smb)
44 / SSH/SFTP
   \ (sftp)
45 / Sia Decentralized Cloud
   \ (sia)
46 / Storj Decentralized Cloud Storage
   \ (storj)
47 / Sugarsync
   \ (sugarsync)
48 / Transparently chunk/split large files
   \ (chunker)
49 / Uloz.to
   \ (ulozto)
50 / Union merges the contents of several upstream fs
   \ (union)
51 / Uptobox
   \ (uptobox)
52 / WebDAV
   \ (webdav)
53 / Yandex Disk
   \ (yandex)
54 / Zoho
   \ (zoho)
55 / premiumize.me
   \ (premiumizeme)
56 / seafile
   \ (seafile)
Storage> 52
# 选择webdav对应的编号 我这边为52 需要根据你实际编号选择

Option url.
URL of http host to connect to.
E.g. https://example.com.
Enter a value.
url> http://192.168.1.1:8800
# 输入你Webdav服务器对应的链接与端口

Option vendor.
Name of the WebDAV site/service/software you are using.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
 1 / Fastmail Files
   \ (fastmail)
 2 / Nextcloud
   \ (nextcloud)
 3 / Owncloud
   \ (owncloud)
 4 / Sharepoint Online, authenticated by Microsoft account
   \ (sharepoint)
 5 / Sharepoint with NTLM authentication, usually self-hosted or on-premises
   \ (sharepoint-ntlm)
 6 / rclone WebDAV server to serve a remote over HTTP via the WebDAV protocol
   \ (rclone)
 7 / Other site/service or software
   \ (other)
vendor> 7
# Rclone提供了几种常用的Webdav设置 我为自己搭建 选择7(other)

Option user.
User name.
In case NTLM authentication is used, the username should be in the format 'Domain\User'.
Enter a value. Press Enter to leave empty.
user> DAV_user
# 输入Webdav用户名

Option pass.
Password.
Choose an alternative below. Press Enter for the default (n).
y) Yes, type in my own password
g) Generate random password
n) No, leave this optional password blank (default)
y/g/n> y
# 需要密码 选择y
Enter the password:
password:
Confirm the password:
password:
# 输入密码时不会显示密码

Option bearer_token.
Bearer token instead of user/pass (e.g. a Macaroon).
Enter a value. Press Enter to leave empty.
bearer_token>
# 没有设置令牌按回车留空

Edit advanced config?
y) Yes
n) No (default)
y/n> n
# 开启高级设置 这边并不需要 选择n

#确认你的设置是否有错误
Configuration complete.
Options:
- type: webdav
- url: http://192.168.1.30:8800
- vendor: other
- user: DAV_user
- pass: *** ENCRYPTED ***
Keep this "webdav" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
# 确认无误

Current remotes:

Name                 Type
====                 ====
webdav               webdav

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q>q
# 可以看到自己的设置了 退出

4 Rclone挂载

设置完服务器后,便可以使用Rclone进行挂载了

在Rclone所在文件夹打开命令行,输入

.\rclone.exe mount webdav:/ W: --vfs-cache-mode writes --cache-dir ./cache --log-level INFO --progress --file-perms 0777

下面分开解释命令意义

.\rclone.exe 
指代当前文件夹下的rclone.exe文件
mount
挂载命令
webdav:/ W:
webdav指的是你设置的名称 :/表示挂载的远程文件夹 W:指挂载在电脑上的盘符
--vfs-cache-mode writes
vfs虚拟文件系统 缓存模式 写入 
Rclone存在4种缓存模式:off|minimal|writes|full 
缓存模式越高,rclone 的兼容性就越好,但会占用更多的磁盘空间
如果你的网速够快可以考虑选择off 关闭缓存
--cache-dir ./cache
缓存目录 这里./cache指 在本文件夹下的cache文件夹中
--log-level INFO --progress
让命令行输入INFO类型的日志 同时显示上传或下载的进度条
--file-perms 0777
更改文件权限 设置为全部权限(UNIX格式)
默认的权限为0666,即不包含运行权限
如果你不需要在挂载中运行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文本,放入以下内容

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文本,放入以下内容

D:\Rclone\rclone.exe mount webdav:/ W: --vfs-cache-mode off --file-perms 0777

将txt文本后缀改为bat

新建txt文本,放入以下内容

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自己分配可用盘符

.\rclone.exe mount webdav:/ *
将盘符改为" * "
Rclone也可挂载到文件夹中,修改参数可实现

挂载为网络驱动器

--network-mode

修改Windows文件夹访问权限

---dir-perms 0777

VFS目录缓存

--dir-cache-time duration   缓存目录条目时间 (默认为 5m0s)
--poll-interval duration    在轮询更改之间的等待时间 需要小于上面一条的时间 设置为0禁用 (默认为 1m0s)

VFS文件缓冲

--buffer-size
此标志是每个打开文件所用内存的上限。缓冲区将只使用内存来存储已下载但尚未读取的数据。如果缓冲区为空,则只会使用少量内存。

VFS文件缓存

--cache-dir string                     缓存目录
--vfs-cache-mode CacheMode             Cache mode off|minimal|writes|full (默认 off)
--vfs-cache-max-age duration           自上次访问缓存中的对象以来的最大时间 (默认 1h0m0s)
--vfs-cache-max-size SizeSuffix        缓存中对象的最大总大小 (默认 off)
--vfs-cache-min-free-space SizeSuffix  在包含缓存的磁盘上设定最小可用空间的目标 (默认 off)
--vfs-cache-poll-interval duration     轮询缓存以查找过时对象的时间间隔 (默认 1m0s)
--vfs-write-back duration              使用缓存时最后一次使用后写回文件的时间 (默认 5s)
  • 24
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值