Some Bits: Nelson's log

rsync --append trap

I learned something from Claude Code today. rsync --append isn’t very safe. The common pattern of rsync --partial --append is suggested as a way to copy files and allow resume. That’s not a good idea to put in recurring sync jobs you run regularly over a long period of time.

The problem is --append won’t retransfer a file in many circumstances if the contents changed. And it only writes new data. It is append only and rsync’s man page warns it is “only applicable to update files that are known to be growing larger, that is, where any existing content on the receiving side is also known to be the same as the content on the sender”. If the file changes on the sending side, it can cause all sorts of corruption on the receiver.

I was using rsync --append to sync video between two machines once a week. But the source occasionally updated files in-place when I got better copies of the video. The destination wouldn’t replace the file when the source changed and so my destination slowly got out of sync.

Before 2008 and rsync 3.0, rsync did more checking with --append. So old advice may not have been wrong at the time.

In modern rsync there’s a --append-verify that will help but won’t catch the case where the updated file is smaller than the original. --append will still skip it in that case.

Claude Code advises me to not use --append at all, it’s the --partial that does the work of allowing resumes (for network copies). There’s also a --partial-dir which keeps partial downloads in an out-of-sight directory until they’re done.

If you’ve been running --append on a mirror, do an rsync -c to verify checksums and find damaged files.