Open ynikitenko opened 2 years ago
@ynikitenko while I do not presume your objective, I have implemented systems of timestamp based hardlink snapshots (commits?). Although it requires more storage, I have found duplicating the source data before creating hardlink snapshots is essential, as well as using the --link-dest
switch. In https://github.com/georgalis/pub/blob/master/sub/backlink.sh for each 'commit' I create a new timestamp directory and link the last timestamp directory when preserving my src directory tree. I am not following your need for --ignore-existing
maybe just don't use --delete
and your target will be cumulative, even when files are deleted from the source?
@georgalis sorry for a late reply. In my program --ignore-existing is important for safety. From yarsync README:
If a file gets corrupt, it will not be transferred by default, but when the user chooses to pull --backup, any diverged files will be visible (with their different versions preserved).
For me it is important that I use rsync and don't do these things manually. I think it is more reliable if these details are handled in one place, at the level of rsync. I want to synchronise directories, that is why I both add new files and remove deleted ones.
I don't want my repositories to take more space than needed, that's why I would not duplicate data (unless some files really diverged between commits - but it is impossible to know for hard links; only when these hardlinks are in different systems/repositories).
I store several versions of my directory in snapshots (called commits), these are just hard links to files in the original directory. I don't want to pull actual changes (if there were any), and I add --ignore-existing to
rsync
options,Unfortunately, in this case all hard links for newer snapshots are broken (and when I drop this option, they are preserved). As I understand, it follows from the fact that --ignore-existing is a transfer rule, so all other (existing) hard links are ignored by
rsync
, and the snapshot is created anew.Do I understand this right? Can I preserve all hard links and simultaneously ignore any changes in existing files?