说明
Rclone
是一款命令行工具,支持在不同对象存储、网盘之间同步、上传、下载数据;
官网地址:https://rclone.org
本教程适用于Debian
/ Ubuntu
系统,如果你是CentOS
或者其它Linux
系统,请使用以下命令安装rclone
CentOS
安装:
curl https://rclone.org/install.sh | sudo bash
安装
Debian
/ Ubuntu
安装:
wget https://downloads.rclone.org/rclone-current-linux-amd64.zip
unzip rclone-current-linux-amd64.zip
chmod 0777 ./rclone-*/rclone
cp ./rclone-*/rclone /usr/bin/
rm -rf ./rclone-*
适用于ARM
框架安装命令:(如甲骨文Oracle等)
wget https://downloads.rclone.org/rclone-current-linux-arm64.zip
unzip rclone-current-linux-arm64.zip
chmod 0777 ./rclone-*/rclone
cp ./rclone-*/rclone /usr/bin/
rm -rf ./rclone-*
配置
安装完成后输入以下命令开始配置Rclone
rclone config
详细过程
root@SunPma ~ # 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> GD // 新建配置的名称,随意填写,后面会用到
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> 15 // 选择需要挂载的网盘
** See help for drive backend at: https://rclone.org/drive/ **
Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
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> // 直接回车
Scope that rclone should use when requesting access from drive.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / Full access all files, excluding Application Data Folder.
\ "drive"
2 / Read-only access to file metadata and file contents.
\ "drive.readonly"
/ Access to files created by rclone only.
3 | These are visible in the drive website.
| File authorization is revoked when the user deauthorizes the app.
\ "drive.file"
/ Allows read and write access to the Application Data folder.
4 | This is not visible in the drive website.
\ "drive.appfolder"
/ Allows read-only access to file metadata but
5 | does not allow any access to read or download file content.
\ "drive.metadata.readonly"
scope> 1 // 输入1回车
ID of the root folder
Leave blank normally.
Fill in to access "Computers" folders (see docs), or for rclone to use
a non root folder as its starting point.
Enter a string value. Press Enter for the default ("").
root_folder_id> // 直接回车
Service Account Credentials JSON file path
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`.
Enter a string value. Press Enter for the default ("").
service_account_file> // 直接回车
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> n // 是否使用自动配置,输入n回车
Please go to the following link: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=XXX
Log in and authorize rclone for access
Enter verification code> XXXXXXXXX // 复制上面的链接在浏览器中打开,将得到的授权码复制到这里后回车
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No (default)
y/n> y // 是否挂载团队网盘,如果没有输入n回车,需要挂载团队版输入y回车
Fetching Shared Drive list...
Choose a number from below, or type in your own value
1 / 网盘01
\ "0AFI6nNW8zXXXXXXX"
2 / 网盘02
\ "0ADYACmKjlXXXXXXX"
Enter a Shared Drive ID> 1 // 择你需要挂载的团队盘然后回车
--------------------
[GD]
type = drive
scope = drive
token = {"access_token":"XXX","token_type":"Bearer","refresh_token":"XXX","expiry":"2021-05-28T03:03:25.613977754+08:00"}
team_drive = 0AFI6nNW8zXXXXXXX
root_folder_id =
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y // 没有问题,输入y回车
Current remotes:
Name Type
==== ====
GD drive
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回车
挂载磁盘
/usr/bin/rclone mount DriveName:Folder LocalFolder \
--umask 0000 \
--default-permissions \
--allow-non-empty \
--allow-other \
--transfers 1 \
--buffer-size 64M \
--low-level-retries 200
## 上面代码是一个整体,全部复制后粘贴运行
DriveName # 配置时填写的name
Folder # 网盘里要挂载的文件夹名
LocalFolder # 本地要挂载的文件夹绝对路径
## 例:/usr/bin/rclone mount GD:VPS /home/GoogleDrive \
参数说明:--transfers
该参数是最大同时传输任务数量,如果经常传输大文件,或CPU性能不佳,建议设置为单线程,也就是设置为“1”--buffer-size
该参数为读取每个文件时的内存缓冲区大小,控制rclone上传和挂载的时候的内存占用--low-level-retries
该参数为传输文件没速度的时候重试次数,没速度的时候,单个会自动睡眠10ms起,然后再重试
如果你还涉及到读取使用,比如使用H5ai等在线播放,就在后面多加上以下三条参数:
--dir-cache-time 12h
--vfs-read-chunk-size 32M
--vfs-read-chunk-size-limit 1G
出现错误
## 如果出现如下错误
Fatal error: failed to mount FUSE fs: fusermount: exec: "fusermount": executable file not found in $PATH
## 安装fuse即可
apt install fuse
挂载成功后,输入df -h
命令查看是否挂载成功:
卸载磁盘
fusermount -qzu LocalFolder
## LocalFolder为本地挂载文件夹绝对路径
Rclone
的具体操作命令可以参考:https://suntl.com/864.html
版权声明:本文为原创文章,版权归 suntl.com 所有,转载请注明出处!
本文链接:https://suntl.com/567.html
友情提示:如果博客出现404或链接失效,请留言或者联系博主修复!
Rclone 无法挂载 google drive 怎么回事?
2020/03/11 21:41:36 Fatal error: failed to mount FUSE fs: fusermount: exec: "fusermount": executable file not found in $PATH