1

Is there some way to make rsync report why it decided to make a new copy of a file, instead of hard-linking it? (E.g. because of timestamp, or detected a change in content... etc.)

(I'm creating incremental backups but some files which should not have been changed for long time, are still getting copied over instead of hard-linked.)

Related, but does not solve my problem: rsync --link-dest not linking

In that question, all files are being copied instead of linked, whereas in my case only some files are being copied (so I guess the syntax of the command is correct).

For reference, the command I'm using is:

rsync -av -delete --link-dest=/path/to/previous/backup/ /path/to/source/ /path/to/new/backup/

(Note the slashes at the end!)

3
  • 1
    Use -i (--itemize-changes) in place of -v (--verbose). It will give you more information about why a file is being copied. If that solves your issue, I may write it up as a proper answer later (if nobody else does first).
    – Kusalananda
    Commented May 9, 2021 at 19:12
  • Thanks, that was it indeed. For the records, I got this result: cf.....g..., which, if I understand correctly, means that checksum and group are different. The checksum did not change, though (I tried md5sum), but the groups were indeed not the same.
    – Attilio
    Commented May 9, 2021 at 19:43
  • 1
    No, initial c just means that this update is a "change". (The first character is the "update type". Had it been a transfer then it would have had > or < instead). What's happening for that particular file is that the group is changed.
    – Kusalananda
    Commented May 9, 2021 at 21:22

1 Answer 1

3

Using --itemize-changes (or -i) in place of -v gives slightly more information about the reason something happens to the files that you run rsync on.

For example, if a file has had its group ownership changed but nothing else, you may see something like cf.....g... for that file. The initial character is the "update type" and a c simply means "change" (i.e. not a transfer of file data). The following f is the file type ("regular file"). The g further along the string means that the group is different between the source and the target.

This is all described in the rsync manual. Look for the longer description of the --itemize-changes option.

When the meta data of a file changes, it can no longer be created as a hard link of an pre-existing copy of the same file with --link-dest. The meta data can't be different for hard links of the same file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .