Hello World

发现美 记录美 创造美

Unraid上使用rclone插件挂载网盘

学习实践 0 评 206 °C

安装rclone插件

应用中搜索rclone 选择这个插件安装,其他两个为docker 安装完成后会出现在设置-用户实用程序
1681721706.png

连接网盘

微软网盘 因Unraid没有浏览器 所以rclone无法直接获取code来连接网盘 我们采用这种的方式来,在windows上获取config内容 下载个客户端 假设解压到c盘根目录

C:\Users\Administrator>cd c:\rclone

切换到解压目录

c:\rclone>rclone config

开始配置

No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n

选择n新建

name> onedrive

建立个名称

Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / 1Fichier
   \ "fichier"
 2 / Alias for an existing remote
   \ "alias"
 3 / Amazon Drive
   \ "amazon cloud drive"
 4 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, and Tencent COS
   \ "s3"
 5 / Backblaze B2
   \ "b2"
 6 / Box
   \ "box"
 7 / Cache a remote
   \ "cache"
 8 / Citrix Sharefile
   \ "sharefile"
 9 / Compress a remote
   \ "compress"
10 / Dropbox
   \ "dropbox"
11 / Encrypt/Decrypt a remote
   \ "crypt"
12 / Enterprise File Fabric
   \ "filefabric"
13 / FTP Connection
   \ "ftp"
14 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
15 / Google Drive
   \ "drive"
16 / Google Photos
   \ "google photos"
17 / Hadoop distributed file system
   \ "hdfs"
18 / Hubic
   \ "hubic"
19 / In memory object storage system.
   \ "memory"
20 / Jottacloud
   \ "jottacloud"
21 / Koofr
   \ "koofr"
22 / Local Disk
   \ "local"
23 / Mail.ru Cloud
   \ "mailru"
24 / Mega
   \ "mega"
25 / Microsoft Azure Blob Storage
   \ "azureblob"
26 / Microsoft OneDrive
   \ "onedrive"
27 / OpenDrive
   \ "opendrive"
28 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
29 / Pcloud
   \ "pcloud"
30 / Put.io
   \ "putio"
31 / QingCloud Object Storage
   \ "qingstor"
32 / SSH/SFTP Connection
   \ "sftp"
33 / Sugarsync
   \ "sugarsync"
34 / Tardigrade Decentralized Cloud Storage
   \ "tardigrade"
35 / Transparently chunk/split large files
   \ "chunker"
36 / Union merges the contents of several upstream fs
   \ "union"
37 / Webdav
   \ "webdav"
38 / Yandex Disk
   \ "yandex"
39 / Zoho
   \ "zoho"
40 / http Connection
   \ "http"
41 / premiumize.me
   \ "premiumizeme"
42 / seafile
   \ "seafile"
Storage> 26

如要连接谷歌的盘,根据标识选择26(版本不同,序号不一定一样,按实际标识选择)

** See help for onedrive backend at: https://rclone.org/onedrive/ **

OAuth Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id>

不输入,直接回车

OAuth Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>

不输入,直接回车

Choose national cloud region for OneDrive.
Enter a string value. Press Enter for the default ("global").
Choose a number from below, or type in your own value
 1 / Microsoft Cloud Global
   \ "global"
 2 / Microsoft Cloud for US Government
   \ "us"
 3 / Microsoft Cloud Germany
   \ "de"
 4 / Azure and Office 365 operated by 21Vianet in China
   \ "cn"
region> 1

选择1

Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n> n

选择n,不编辑

Remote config
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
y) Yes (default)
n) No
y/n> y

选择1自动配置

If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=FDOLLiSz***rSJBbag
Log in and authorize rclone for access
Waiting for code...
Got code

点击链接,登陆账户,授权给rclone使用,脚本自动获取code

Choose a number from below, or type in an existing value
 1 / OneDrive Personal or Business
   \ "onedrive"
 2 / Root Sharepoint site
   \ "sharepoint"
 3 / Sharepoint site name or URL (e.g. mysite or https://contoso.sharepoint.com/sites/mysite)
   \ "url"
 4 / Search for a Sharepoint site
   \ "search"
 5 / Type in driveID (advanced)
   \ "driveid"
 6 / Type in SiteID (advanced)
   \ "siteid"
 7 / Sharepoint server-relative path (advanced, e.g. /teams/hr)
   \ "path"
Your choice> 1

选择1

Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=b!jC7ndQM3XkO5C6RFjk8FC0l6JPipknpLuC4BB4ohz64u3aY5OQn_T4Vh-Rr-ZaZD
Chose drive to use:> 0

选择标识的0网盘

Found drive 'root' of type 'business', URL: https://kogfw***.sharepoint.com/personal/s1oz_****/Documents
Is that okay?
y) Yes (default)
n) No
y/n> y

选择y

--------------------
[onedrive]
type = onedrive
region = global
token = {"access_token":"eyJ0eXAiLiIs**gU2l0ZXMuUmVhZC5BbGwgcHJvZmlsZSMastoKDtaM8uxbH-ypRGI0y8H_ysiRw20QRRLc7pdol6BmYo0BcRNXJgJN6xccP5b20-iyLejE_vF1Iw5AKQP4-qirH3NHP-S5l*********pLuC4BB4ohz64u3aY5OQn_T4Vh-Rr-ZaZD
drive_type = business
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y

显示相关config信息,提示你是否确认 输入y

Current remotes:

Name                 Type
====                 ====
onedrive             onedrive

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

按q退出配置界面 将刚显示的这段config信息粘贴到rclone插件中

--------------------
[onedrive]
type = onedrive
region = global
token = {"access_token":"eyJ0eXAiLiIs**gU2l0ZXMuUmVhZC5BbGwgcHJvZmlsZSMastoKDtaM8uxbH-ypRGI0y8H_ysiRw20QRRLc7pdol6BmYo0BcRNXJgJN6xccP5b20-iyLejE_vF1Iw5AKQP4-qirH3NHP-S5l*********pLuC4BB4ohz64u3aY5OQn_T4Vh-Rr-ZaZD
drive_type = business

粘贴至Unraid设置-用户实用程序-rclcone

1681722052.png

然后在Unraid终端中输入

rclone config

即可看到已经连接的网盘信息

1681722080.png

创建用于挂载磁盘的目录 根据自己需求,新建一个用于挂载网盘的空文件夹

mkdir -p /mnt/user/rclone/onedrive

我想分的细一点,所以等下使用`onedrive空文件夹挂载刚刚连接的谷歌团队盘

挂载网盘到本地 示例

rclone mount onedrive:test /mnt/user/rclone/onedrive --umask 0000 --default-permissions --allow-non-empty --allow-other --buffer-size 32M --low-level-retries 200 --dir-cache-time 2h --vfs-read-chunk-size 64M --vfs-read-chunk-size-limit 1G &

需要修改的就是 onedrive:test onedrive为网盘的名字不特指微软网盘test为要挂载的网盘文件夹路径,不填留为挂载整个网盘 /mnt/user/rclone/onedrive本地用于挂载的空目录 关于其他参数含义,可自行查阅最下方命令说明 如需要给emby之类使用,挂载文件夹不显示文件,请修改--umask 000 在emby终端输入 umask

/ # umask
0022
/ #

将示例中--umask 000修改为--umask 0022 emby即可正常访问文件

查询是否成功将网盘挂载到本地

df -h

输入命令后,如成功挂载,就会有显示挂载的目录了

开机自动挂载 可使用User Scripts插件新建开机任务,输入示例命令

常用命令

fusermount -qzu /mnt/user/rclone/onedrive

按挂载的目录路径,卸载已挂载的网盘

https://rclone.org/commands/

官方的命令说明

升级局域网并安装群晖nas
快来做第一个评论的人吧~