使用 rclone 将数据加密备份至 Google Drive 或OneDrive

本文的目标是用rclone创建一个不考虑容量的文件夹用来备份数据。这个文件夹中的所有内容都将被实时加密并推送到Google Drive或者OneDrive,并且支持缓存。


只记录重点:


配置文件:

[google]
type = drive
client_id = *.apps.googleusercontent.com
client_secret = *
scope = drive
token = {"access_token":"****************"}
team_drive = **********
root_folder_id = 

[GDrive1Cache]
type = cache
remote = google:
chunk_size = 50M
info_age = 1h0m0s
chunk_total_size = 10G

[GDrive1Crypt]
type = crypt
remote = GDrive1Cache:
filename_encryption = standard
directory_name_encryption = true
password = ************



第一段正常配置任意网盘


第二段缓存第一段里面的网盘


第三段配置加密,密码在配置向导里面自己设置的。



手动挂载

rclone mount GDrive1Crypt: /home/gdrive --allow-other --allow-non-empty --vfs-cache-mode writes


开机挂载

command="mount GDrive1Crypt: /home/gdrive --allow-other --allow-non-empty --vfs-cache-mode writes"

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

[Service]
Type=simple
ExecStart=$(command -v rclone) ${command}
ExecStop=fusermount -u /home/gdrive
Restart=on-abort
User=root

[Install]
WantedBy=default.target
EOF




systemctl daemon-reload

systemctl enable rclone

systemctl start rclone


看下挂载是否正常

df -h