rsync

Ignoring File Attributes with rync --link-dest


I have a simple script which runs rsync periodically to backup my storage drive

rsync --delete --stats -PSvahHAXx --log-file=Backup_<TIME> 
      --link-dest=Backups/<lastBackup> <StorageDrive> "Backups/<nextBackup>"

If I reorganize my storage between backups, rsync would not recognize it and would just create a new copy, instead of creating a hardlink (e.g. renaming or moving a folder). That's why I follow the above command with

jdupes --recurse -L Backups/

Finding duplicates and linking them with hardlinks.

However, when I do this, the next time I run rsync, it does not create hardlinks, but copies everything again. I guess because some attributes of the files are now different to the source of the storage drive.

Is there a way to tell rsync to ignore file attributes and just compare the content of the file at the same location, to determine if its the same and can be represented by a hardlink.


Solution

  • I was looking up this too and found https://www.baeldung.com/linux/rsync-ignore-file-properties

    The option to add is --no-perms, you can also add --no-times but I will find it strange if times have changed and content has not.