brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: rclone check --one-way confirms every source file arrived at the destination

Rclone
~/tips/tip-backup-rclone-check-one-way

rclone check /mnt/user/photos remote:photos --one-way

Compares the files in a source against a remote destination by size and hash, without copying anything.

After a big upload to a cloud remote, I would want proof that everything arrived. rclone check compares a source with a destination without copying anything, and --one-way keeps the comparison to what matters for a backup.

rclone check /mnt/user/photos remote:photos --one-way

The command compares sizes and hashes (MD5 or SHA1) and logs the files that do not match. With --one-way it only checks that the files in the source match the files in the destination, not the other way around. That is the right question for a backup, because a destination can legitimately hold extra files, such as older versions or other devices. Without the flag, those extras count as differences.

Some remotes cannot give a hash. For those, --download fetches the data from both sides and compares it on the fly, which is thorough but moves every file across your connection. --size-only goes the other way and compares only sizes, which is quick but will not catch a file that changed to the same length.

If you want to know which files are the problem, ask for a report. --combined writes every path with a symbol: = identical, + only on the source, - only on the destination, * different and ! for an error. There are also separate files for just the missing and differing paths:

rclone check /mnt/user/photos remote:photos --one-way --combined report.txt
rclone check /mnt/user/photos remote:photos --one-way --missing-on-dst missing.txt --differ differ.txt

The parallel checks default to 8 (--checkers), so a big tree is not slow to compare unless it needs downloads. One caveat: the page documents the flags but not the exit codes, so if you plan to use this in a cron job, test how it behaves with a deliberately missing file before relying on the status. And a check right after the upload only proves that the remote has the files today. It is no substitute for an occasional real restore.

Further reading: rclone docs: rclone check

More Rclone tips rclone copyurl https://example.com/files/big.iso remote:isos -a rclone size remote:photos rclone config redacted rclone ncdu remote:backup rclone copy /data remote:data --bwlimit "08:00,1M 18:00,5M 23:00,off" -P All Rclone tips (14) All topics

Link