I recently discovered that a few files on a volume had been mysteriously truncated - or more accurately, replaced with a zero length file.
Fortunately, these files were hard-linked from multiple places, and only about half the links were actually overwritten with a zero-length file with seemingly the same attributes.
However, when I looked in my backups, I found the issue had occurred before my previous backup. For the volume in question, a simple mirror backup should be sufficient, because files shouldn't get deleted - it's mostly append only. But since the file isn't actually being deleted, I can't simply tell
rsync to not delete.
Is there a way to tell
rsync to not sync a file that is zero length locally, but has a non-zero length on the remote side?
I could of course simply write some code to look for zero length files and exclude them, but this is an extra time-consuming step (now there are two full scans of the filesystem) and it could exclude files which legitimately should be rsynced (in case there are files that are expected to be zero length).