准备

要先安装好阿里网盘的webdav,参考这篇文章

安装rclone

curl https://rclone.org/install.sh | sudo bash

配置rclone

root@truenas[~]# rclone config
2022/01/18 14:12:40 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> alidriver
Option Storage.
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, SeaweedFS, and Tencent COS
   \ "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 / Compress a remote
   \ "compress"
11 / Dropbox
   \ "dropbox"
12 / Encrypt/Decrypt a remote
   \ "crypt"
13 / Enterprise File Fabric
   \ "filefabric"
14 / FTP Connection
   \ "ftp"
15 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
16 / Google Drive
   \ "drive"
17 / Google Photos
   \ "google photos"
18 / Hadoop distributed file system
   \ "hdfs"
19 / Hubic
   \ "hubic"
20 / In memory object storage system.
   \ "memory"
21 / Jottacloud
   \ "jottacloud"
22 / Koofr
   \ "koofr"
23 / Local Disk
   \ "local"
24 / Mail.ru Cloud
   \ "mailru"
25 / Mega
   \ "mega"
26 / Microsoft Azure Blob Storage
   \ "azureblob"
27 / Microsoft OneDrive
   \ "onedrive"
28 / OpenDrive
   \ "opendrive"
29 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
30 / Pcloud
   \ "pcloud"
31 / Put.io
   \ "putio"
32 / QingCloud Object Storage
   \ "qingstor"
33 / SSH/SFTP Connection
   \ "sftp"
34 / Sia Decentralized Cloud
   \ "sia"
35 / Sugarsync
   \ "sugarsync"
36 / Tardigrade Decentralized Cloud Storage
   \ "tardigrade"
37 / Transparently chunk/split large files
   \ "chunker"
38 / Union merges the contents of several upstream fs
   \ "union"
39 / Uptobox
   \ "uptobox"
40 / Webdav
   \ "webdav"
41 / Yandex Disk
   \ "yandex"
42 / Zoho
   \ "zoho"
43 / http Connection
   \ "http"
44 / premiumize.me
   \ "premiumizeme"
45 / seafile
   \ "seafile"
Storage> 40
Option url.
URL of http host to connect to.
E.g. https://example.com.
Enter a string value. Press Enter for the default ("").
url> http://10.0.0.10:8880/
Option vendor.
Name of the Webdav site/service/software you are using.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value.
 1 / Nextcloud
   \ "nextcloud"
 2 / Owncloud
   \ "owncloud"
 3 / Sharepoint Online, authenticated by Microsoft account
   \ "sharepoint"
 4 / Sharepoint with NTLM authentication, usually self-hosted or on-premises
   \ "sharepoint-ntlm"
 5 / Other site/service or software
   \ "other"
vendor> 5
Option user.
User name.
In case NTLM authentication is used, the username should be in the format 'Domain\User'.
Enter a string value. Press Enter for the default ("").
user> admin
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
Enter the password:
password:
Confirm the password:
password:
Option bearer_token.
Bearer token instead of user/pass (e.g. a Macaroon).
Enter a string value. Press Enter for the default ("").
bearer_token> 
Edit advanced config?
y) Yes
n) No (default)
y/n> n
--------------------
[alidriver]
type = webdav
url = http://10.0.0.10:8880/
vendor = other
user = admin
pass = *** ENCRYPTED ***
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:

Name                 Type
====                 ====
alidriver            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

挂载

mkdir /mnt/alidriver

创建挂载点

rclone mount alidriver:影片 /mnt/alidriver --cache-dir /tmp --allow-other --vfs-cache-mode writes --allow-non-empty &

alidriver:影片 为阿里网盘的Name:目录

卸载

fusermount -qzu /mnt/alidriver

docker方式挂载

要先按以上的命令(除了挂载),生成配置文件,配置文件默认在/root/.config/rclone里面,建议把配置文件文件复制到数据集中,因为scale更新会删除其他位置的文件

docker run -d \
--name rclone \
--restart=always \
--network=host \
-v <配置文件的目录>:/config/rclone \
-v <准备挂载的目录>:<准备挂载的目录>:shared \
--device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined \
rclone/rclone \
mount aliyundriver:video <准备挂载的目录> --allow-other --vfs-cache-mode writes --allow-non-empty

aliyundriver:video 为阿里网盘的Name:目录

示例

docker run -d \
--name rclone \
--restart=always \
--network=host \
-v /mnt/SSD/apps/rclone:/config/rclone \
-v /mnt/alidriver:/mnt/alidriver:shared \
--device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined \
rclone/rclone \
mount aliyundriver:video /mnt/alidriver --allow-other --vfs-cache-mode writes --allow-non-empty

docker compose方法挂载

version: '3'
services:
  rclone:
    container_name: rclone
    network_mode: host
    image: rclone/rclone
    volumes:
      - /mnt/SSD/apps/rclone:/config/rclone
      - /mnt/alidriver:/mnt/alidriver:shared
    devices:
      - /dev/fuse      
    cap_add:
      - SYS_ADMIN
    security_opt:
      - apparmor=unconfined
    restart: always
    command: mount aliyundriver:video /mnt/alidriver --allow-other --vfs-cache-mode writes --allow-non-empty
最后修改:2022 年 02 月 25 日
感谢您的支持