介绍

rclone 是一个命令行同步文件的工具。支持众多协议,比如s3,本地文件,onedrive

安装

参考

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

配置使用

以s3为例,可以使用rclone config按照提示一步步配置,也可以使用配置文件/root/.config/rclone/rclone.conf

参考

# 示例配置
[s3]
type = s3
provider = Other
env_auth = false
access_key_id = <access_key_id>
secret_access_key = <secret_access_key>
endpoint = <http://endpoint>
region = <region> # 可以不配置
#acl = public-read-write
#bucket_acl = public-read-write
chunk_size = 64M
disable_checksum = true
upload_concurrency = 4

rclone config file可以查看默认配置文件的位置。

常用命令

参考

rclone config – Enter an interactive configuration session.
rclone copy – Copy files from source to dest, skipping already copied.
rclone sync – Make source and dest identical, modifying destination only.
rclone move – Move files from source to dest.
rclone delete – Remove the contents of path.
rclone purge – Remove the path and all of its contents.
rclone mkdir – Make the path if it doesn’t already exist.
rclone rmdir – Remove the path.
rclone rmdirs – Remove any empty directories under the path.
rclone check – Check if the files in the source and destination match.
rclone ls – List all the objects in the path with size and path.
rclone lsd – List all directories/containers/buckets in the path.
rclone lsl – List all the objects in the path with size, modification time and path.
rclone md5sum – Produce an md5sum file for all the objects in the path.
rclone sha1sum – Produce a sha1sum file for all the objects in the path.
rclone size – Return the total size and number of objects in remote:path.
rclone version – Show the version number.
rclone cleanup – Clean up the remote if possible.
rclone dedupe – Interactively find duplicate files and delete/rename them.
rclone authorize – Remote authorization.
rclone cat – Concatenate any files and send them to stdout.
rclone copyto – Copy files from source to dest, skipping already copied.
rclone genautocomplete – Output shell completion scripts for rclone.
rclone gendocs – Output markdown docs for rclone to the directory supplied.
rclone listremotes – List all the remotes in the config file.
rclone mount – Mount the remote as a mountpoint.
rclone moveto – Move file or directory from source to dest.
rclone obscure – Obscure password for use in the rclone.conf
rclone cryptcheck – Check the integrity of a crypted remote.
rclone about – Get quota information from the remote.

注意事项

mount默认是在前台运行,使用--daemon可以放到后台运行

使用过程遇到的问题

挂载容量问题,现在是1PB

https://forum.rclone.org/t/rclone-mount-question/15454

创建失败也不报错

rclone ls s3: 会list所有bucket中的所有文件