technology:vps:rclone挂载多家云盘到本地

Rclone is a command line program to sync files and directories to and from1)


方法一:rclone一键安装脚本
curl https://rclone.org/install.sh | sudo bash

方法二:
wget https://www.moerats.com/usr/shell/rclone_debian.sh && bash rclone_debian.sh

Linux

# Linux
$ rclone mount GoogleDrive:/  /home/wwwroot/cloud.920.ai/data/MyCloud --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000

Windows

  1. 下载winfsp

下载地址:https://github.com/billziss-gh/winfsp/releases/tag/v1.0

  1. 挂载命令
# 挂载文件夹
$ rclone mount onedrive: D:\onedrive --allow-other --vfs-cache-mode writes --allow-non-empty &
 
# 挂载盘符
$ rclone mount googledriveul:/ o: --cache-dir C:\Temp --allow-other --vfs-cache-mode writes --allow-non-empty &

媒体服务器

rclone mount DriveName:Folder LocalFolder \
 --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 mount sugarhost:/  /cloud/SugarHost --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000
 
rclone mount onedrive:/  /cloud/OneDrive --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000
 
rclone mount googledrive:/  /cloud/GoogleDrive --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000
 
rclone mount googledriveul:/  /cloud/GoogleDriveUnLimited --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000
 
rclone mount googledriveul:/ /cloud/GoogleDriveUnLimited \
 --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
 
umount /cloud/SugarHost
umount /cloud/OneDrive
umount /cloud/GoogleDrive
umount /cloud/GoogleDriveUnLimited

使用Systemctl守护进程,也只适用于CentOS 7Debian 8+Ubuntu 16+2)

#以下是一整条命令,先修改DriveName:Folder和LocalFolder的值,再一起复制到SSH客户端运行
#如果需要挂载多个网盘,按上面的教程新运行个 Rclone 配置,再新建一个/etc/systemd/system/rclone@.service 文件
 
cat > /etc/systemd/system/rclone.service <<EOF
[Unit]
Description=Rclone-GoogleDriveUL
AssertPathIsDirectory=/cloud/GoogleDriveUnLimited
After=network-online.target
 
[Service]
Type=simple
ExecStart=/usr/bin/rclone mount googledriveul:/ /cloud/GoogleDriveUnLimited \
 --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 /cloud/GoogleDriveUnLimited
Restart=on-abort
User=root
 
[Install]
WantedBy=default.target
EOF
# loadOneDrive
 
cat > /etc/systemd/system/rclone@onedrive.service <<EOF
[Unit]
Description=Rclone-OneDrive
AssertPathIsDirectory=/cloud/OneDrive
After=network-online.target
 
[Service]
Type=simple
ExecStart=/usr/bin/rclone mount onedrive:/ /cloud/OneDrive \
 --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 /cloud/OneDrive
Restart=on-abort
User=root
 
[Install]
WantedBy=default.target
EOF

开始启动:

$ systemctl start rclone

设置开机自启:

$ systemctl enable rclone

其他命令:

#重启
$ systemctl restart rclone
#停止
$ systemctl stop rclone
#状态
$ systemctl status rclone

  • technology/vps/rclone挂载多家云盘到本地.txt
  • 最后更改: 2019/09/20 12:19
  • (外部编辑)