Checksum filter rule
ms at citd.de
Sat Jul 28 03:39:18 MDT 2012
On 28.07.2012 10:36, teramide wrote:
> I'm using rsync to make backups. In my dataset, however, there are a
> few encrypted Truecrypt volumes. When these files are modified, the
> content changes but the timestamps are not updated. Thus, rsync will
> not sync these files by default. I would like to keep the behavior
> of Truecrypt and have rsync update the files correctly.
> Using the --checksum option comes to mind in this case. However,
> this will cause rsync to calculate a checksum for *all* files of my
> dataset, slowing down the backup enormously. The workaround I have
> come up with is to first execute an rsync without the --checksum
> option on the whole dataset, and then another rsync with --checksum
> only for the encrypted files. This is significantly faster, but
> still not optimal since I'm running rsync twice on the same dataset.
> Is there any better way to do this? I have searched the archives of
> the rsync mailing list, but could not come up with a better
> This has prompted me to make following suggestion: would it be
> possible to add filter rules for calculating checksums? Just like
> you would have rules to include, exclude and merge files, you could
> define filter rules for files that have to be checked with a
> checksum. I could imagine other uses for this, for example to force
> an extra check (e.g. against corruption) on very important files in
> a dataset, etc.
> (Please do also make suggestions if you find a way to improve the
> procedure in my specific case.)
I'd say that calls for a little scripting.
I guess your number of affected files is small.
So i'd just use the "md5sum"-command to generate a md5sum of each
affected file and before the rsync run you regenerate and compare the
md5sums. When a file has changed just "touch" it, then rsync sees a
changed timestamp and will copy it.
I assume you use Linux: For a little added bonus you could use inotify
to get a notification when one of the files gets changed, then you can
use that notification instead of the md5sum or as a basis for which
files need checking.
Real Programmers consider "what you see is what you get" to be just as
bad a concept in Text Editors as it is in women. No, the Real Programmer
wants a "you asked for it, you got it" text editor -- complicated,
cryptic, powerful, unforgiving, dangerous.
More information about the rsync