使用Rclone挂载Google Drive网盘教程
侧边栏壁纸
博主昵称
记忆の风

有钱终成眷属,没钱亲眼目睹

  • 累计撰写 78 篇文章
  • 累计收到 19 条评论

使用Rclone挂载Google Drive网盘教程

记忆の风
2022-05-19 / 0 评论 / 19 阅读 / 正在检测是否收录...

VPS扩容 使用Rclone挂载Google Drive网盘教程

目录
一、安装挂载工具rclone
二、配置rclone
三、挂载Google Drive

Rclone是一个网盘本地挂载软件,能将全世界多个热门的网盘挂载为系统本地磁盘,实现方便快捷的云盘文件管理效果。搭配无限空间的Google Drive网盘,相当于在电脑上安装了一个无比巨大的磁盘。

一般挂载Google Drive的时候,默认是使用的官方提供的api,所以高峰期上传文件的时候,由于很多人在用,导致api的流量上限,会出现各种403,ratelimit等错误,最常见的报错提示为:Failed to get file: googleapi: Error 403: Rate Limit Exceeded, rateLimitExceeded,然后目前的解决方法就是使用自己的api。

今天和大家分享在VPS上使用Google Drive API挂载Google Drive网盘的方法。

一、安装挂载工具rclone
curl https://rclone.org/install.sh | sudo bash

RCLONE-01-1024x169.png
RCLONE-02-1024x108.png

二、配置rclone
rclone config

RCLONE-03.png
name 可以自定义

Choose a number from below, or type in your own value
选谷歌 (13) 可能会因为版本的不同而改变 注意选择 Google drive

目前版本已改为16

RCLONE-04.png

client_id> 可以用自己的Google Drive API的client_id,也可以直接回车

关于Google Drive API的client_id和client_secret的获取方法可以参考这个教程?

获取/启用自己的Google Drive API凭证教程

RCLONE-05-1024x325.png

client_secret> 可以用自己的Google Drive API的client_secret,也可以直接回车
RCLONE-06-1024x330.png

Choose a number from below, or type in your own value
scope> 1 选1 有最大的使用权限。
RCLONE-07-1024x682.png

Enter a string value. Press Enter for the default (“”).
root_folder_id> 直接回车
RCLONE-08-1024x229.png

service_account_file> 直接回车
RCLONE-09-1024x168.png

Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n> n #不用别的高级配置
RCLONE-10-1024x289.png

Use auto config?

y/n> n
RCLONE-11-1024x278.png

浏览器打开链接登录谷歌账号获取Key

Please go to the following link: https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Log in and authorize rclone for access
Enter verification code>贴入你获取到的key
RCLONE-12-1024x129.png
RCLONE-13-2.png
RCLONE-14-1.png
RCLONE-15-1024x396.png

Configure this as a team drive?
y) Yes
n) No (default)
y/n> 挂载共享网盘选择 y 挂载自己的网盘目录选 n
RCLONE-16-1024x169.png

确认配置是否正确

y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
RCLONE-04.png

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
RCLONE-18.png

三、挂载Google Drive

1.创建一个/GoogleDrive目录,作为挂载目录

mkdir -p /GoogleDrive
RCLONE-20.png

2.挂载

/usr/bin/rclone mount GoogleDrive: /GoogleDrive \
--umask 0000 \
--default-permissions \
--allow-non-empty \
--allow-other \
--buffer-size 32M \
--dir-cache-time 12h \
--vfs-read-chunk-size 64M \
--vfs-read-chunk-size-limit 1G &

RCLONE-19-1024x143.png

–后面跟的是参数 可以自己调整

如果如下报错内容:

Fatal error: failed to mount FUSE fs: fusermount: exec: “fusermount”: executable file not found in $PATH

Centos解决办法:

yum install fuse -y
Debian/Ubuntu解决办法:

apt-get install fuse -y

3.查看挂载

df -h
RCLONE-21-1024x405.png

4.设置自动挂载和开机自启动

cat > /etc/systemd/system/rclone.service <<EOF
[Unit]
Description=Rclone
AssertPathIsDirectory=LocalFolder
After=network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/rclone mount GoogleDrive: /GoogleDrive \
--umask 0000 \
--default-permissions \
--allow-non-empty \
--allow-other \
--buffer-size 32M \
--dir-cache-time 12h \
--vfs-read-chunk-size 64M \
--vfs-read-chunk-size-limit 1G
ExecStop=/bin/fusermount -u LocalFolder
Restart=on-abort
User=root

[Install]
WantedBy=default.target
EOF
命令执行完毕可以用下面的systemctl命令看来控制rclone挂载

启动

systemctl start rclone
开机启动

systemctl enable rclone
重新启动

systemctl restart rclone
停止

systemctl stop rclone

文章摘抄自:https://www.unvone.com/72825.html

0

评论 (0)

取消