rclone 云存储同步速查表 - rclone 文件同步命令大全

rclone 把 S3、OSS、Google Drive、S3 兼容存储与本地目录收进同一套命令,配置阶段用 config 建 remote 命名,之后所有操作都写成 remote:path 的形式。真正需要判断的是动作语义:copy 只复制不删除,sync 会让目标端与源端一致并删掉目标端多余文件,move 则本地也会消失。用错 sync 的代价往往不可逆,所以正式执行前务必 --dry-run 看清单,再加 -v 或 --stats 观察传输进度。表里按配置连接、浏览列表、同步复制、过滤规则、挂载服务、加密校验分组,另外 mount 依赖 fuse 实现,大文件读写记得带 --vfs-cache-mode full 或 writes 避免随机写出错。

系统与运维·共 35 条命令·最后更新 2026-07-21
rclone云存储同步备份

典型使用场景

面向在本地目录与对象存储(S3、网盘、各类远程)之间搬运数据的运维与数据工程人员。本表把 rclone 的动作分成四层:配置层(config / crypt create / config show)、查看层(lsd / ls / tree / size / check / dedupe / hashsum)、搬运层(sync / copy / move / copyto / bisync 与各类 include/exclude/filter)、暴露层(mount / serve http / serve sftp / serve webdav / rcd)。适合迁移备份、云盘挂载、以及在真正执行前用 --dry-run 反复验证同步范围。

配置与连接 6

rclone config
交互式配置远程存储
rclone config show
查看所有远程配置
rclone listremotes
列出已配置的远程名称
rclone config show remote:
查看指定远程的配置
rclone config create remote: s3
非交互式创建远程配置
rclone config delete remote:
删除指定远程配置

浏览与列表 5

rclone lsd remote:
列出远程根目录下的目录
rclone ls remote:path
递归列出远程所有文件
rclone lsl remote:path
列出文件含大小和修改时间
rclone tree remote:path
树形结构展示远程目录
rclone size remote:bucket
统计远程目录总大小和文件数

同步与复制 6

rclone sync /local remote:bucket
同步本地到远程(单向,会删除目标多余文件)
rclone copy /local remote:bucket
复制文件到远程(不删除目标文件)
rclone move /local remote:bucket
移动文件到远程(传输后删除源文件)
rclone sync remote:bucket /local --dry-run
dry-run 预览同步操作
rclone bisync /local remote:bucket
双向同步两个目录
rclone copyto src.txt remote:dst.txt
复制单个文件并重命名

过滤与规则 6

rclone sync /local remote:bucket --include "*.txt"
只同步 txt 文件
rclone sync /local remote:bucket --exclude "*.log"
排除 log 文件
rclone sync /local remote:bucket --exclude-from rules.txt
从文件读取排除规则
rclone sync /local remote:bucket --filter-from filter.txt
从文件读取过滤规则(含包含和排除)
rclone sync /local remote:bucket --max-size 10M
只同步小于 10M 的文件
rclone sync /local remote:bucket --ignore-size
忽略大小,只比较时间

挂载与服务 6

rclone mount remote:bucket /mnt/cloud --vfs-cache-mode full
挂载远程为本地目录,启用完整缓存
rclone mount remote:bucket /mnt/cloud --daemon
后台守护进程方式挂载
rclone serve http remote:bucket --addr :8080
通过 HTTP 服务远程文件
rclone serve sftp remote:bucket --addr :2022
通过 SFTP 服务远程文件
rclone serve webdav remote:bucket --addr :8080
通过 WebDAV 服务远程文件
rclone rcd --rc
启动远程控制 API 服务

加密与校验 6

rclone crypt create remote:encrypted remote:plain
创建加密远程配置
rclone crypt check remote:encrypted remote:plain
校验加密远程一致性
rclone check /local remote:bucket
校验源和目标文件是否一致
rclone dedupe remote:bucket
查找并处理重复文件
rclone hashsum md5 remote:bucket
计算远程文件 MD5 哈希
rclone cleanup remote:bucket
清理远程存储的残留文件

参数矩阵

参数作用示例
sync vs copy vs movesync 双向对齐且会删除目标多余文件;copy 只新增;move 传输后删源,语义差别很大rclone sync /local remote:bucket
--include / --exclude / --filter-from控制同步范围:include 白名单、exclude 黑名单、filter-from 从文件读含排除两类规则rclone sync /local remote:bucket --exclude-from rules.txt
--vfs-cache-mode fullmount 时把远程文件缓存到本地再读写,代价是占磁盘、延迟增加rclone mount remote:bucket /mnt/cloud --vfs-cache-mode full
--dry-run只打印将要执行的操作不实际传输,是任何批量搬运前的必做步骤rclone sync remote:bucket /local --dry-run

易错点与避坑指南

现象执行 sync 之后目标目录里原有的文件消失了。

原因sync 是单向对齐语义,会删除目标端存在而源端没有的文件。

处置先跑 rclone sync remote:bucket /local --dry-run 看清单;只想新增就用 copy,删除要显式确认。

现象反复同步时大量文件被重复传输,远比预期慢。

原因修改时间或大小元数据不一致,rclone 认为文件已改变(常见于跨传输方式或元数据缺失的远程)。

处置加 --ignore-size 只比时间,或先 rclone check /local remote:bucket 判断哪些文件真的不一致。

现象mount 后读写卡顿、本地磁盘被迅速占满。

原因vfs 缓存模式决定是否把远程内容全量落到本地;full 模式缓存最激进。

处置改用 --vfs-cache-mode writes 等更轻的模式,并给缓存目录设上限,再用 rclone cleanup remote:bucket 清残留。

现象报鉴权失败 / 找不到 remote 名称。

原因remote 路径写法不对(必须是 remote:path 冒号形式),或当前用户没读到那份 rclone 配置。

处置用 rclone listremotes 确认名称,再 rclone config show remote: 查看该远程配置是否落在当前用户下。

排障路径

  1. 1搬运前先看清将要发生的操作

    rclone sync remote:bucket /local --dry-run

    dry-run 只打印计划不执行,确认清单里没有误删项再摘掉该参数。

  2. 2确认两端文件是否真的一致

    rclone check /local remote:bucket

    不一致的会列出来,据此判断是否需要 --ignore-size 或重新传输。

  3. 3排查重复文件与残留对象

    rclone dedupe remote:bucket

    交互式列出疑似重复项由你选择保留;残留对象用 rclone cleanup remote:bucket 清理。

提示

  • sync 是单向同步,会删除目标端多余文件;copy 只复制不删除,更安全。
  • mount 需要 fuse 支持,macOS 用 macFUSE,Linux 用 fuse3,建议加 --vfs-cache-mode full。
  • rclone 支持断点续传,大文件传输中断后重新运行即可继续。
  • --progress 参数可以显示实时传输进度和速度,--verbose 显示详细日志。
  • --transfers N 控制并发文件数,--transfers 4 表示同时传输 4 个文件。
  • --bwlimit 1M 限制传输带宽,避免占满网络。
  • rclone size remote:path 递归统计各后缀占用量,找出大文件;--dry-run 配合 size 可预估同步规模。
  • --exclude 规则按 glob 匹配,--exclude-if-present .nobackup 可跳过带标记文件的目录,比 --filter 直观。
  • crypt 后端加密数据但仍走 copy/sync 语义,先 rclone cryptdecode 校验数据无误再删除原始密文目录。

官方参考来源

下方为命令对应的官方权威文档,供你核对最新用法与深入查阅。

由 巧匠 维护

公开更新于 2026年7月21日,内容持续校对官方文档。

联系我们

命令或描述有误?提交反馈、商务合作或产品建议都可发送邮件给我们。

联系我们