rsnapshot to make regular backups of my systems' filesystems to a remote server.
(For those familiar with
rsync but less used to
rsnapshot here is a brief introduction to its workings. A backup is a file-by-file copy of a source file-system tree, much like
cp -a would produce. The "current" backup is always
hourly.0, and the previous one is
hourly.1. These names are rotated each time a backup begins. Under the covers
rsync --link-dest to hardlink unchanged files in
hourly.0 to the corresponding entries in the previous backup tree,
If a backup fails, the previous backup is copied (linked) using
cp -al to the current backup, so that a backup always appears to have been made.
What I would like is to avoid making a backup if there have been no changes since the previous backup. This could include a backup failure or simply that the source filesystem was not modified since the last backup. ("Making a backup" can be rephrased to "deleting an unnecessary backup" if you would prefer.)
I've considered looking in the
hourly.0 tree for files that are not hard-linked elsewhere, and if there is none then simply deleting the backup tree. This does not handle a file that is validly linked elsewhere within its backup, and it also fails to consider changes to directories. I have also considered using
rsync --dry-run to compare the two backup trees and looking at its output but this feels somewhat ugly.
Is there a better solution?