1

Working on Debian 10. Seeing that rdiff-backup has stopped development for quite some time, I'd like to move on my backup-needs to rsync. However, there is one feature of rdiff-backup that I am not prepared to give up:

--remove-older-than 6M

That option will delete files from destination if they have not existed in the source for longer than 6 months.

Is there either

  • a way to do this in rsync? Or
  • some other more modern, scriptable backup-tool for Linux that offers that function?

2 Answers2

1

I strongly suggest using an rsync based tool called rsnapshot: it supports defining specific retention policies, with automatic rotation and deletion.

If you want to use rsync only, you need to find and delete files older than 6 months via the find utility - ie: something as find /your/dir -mtime +180 -daystart -delete.

DISCLAIMER: Before using the -delete subcommand, be sure to test your find command to triple-check it does not select unwanted files.

shodanshok
  • 47,711
  • 7
  • 111
  • 180
  • Thx. But wouldn't "find -mtime +180 -delete" just remove any file from the dest that has not been modified there for 180 days? Plus: Would that act on the source or on the destination? I mean to delete files from dest that have been removed from the source 180 days past, aiming at an ample recovery option while keeping the dest repository reasonably clean. – Markus-Hermann Oct 13 '19 at 18:18
  • The `find` command given above will delete from destination all files older than 180 days, even if they exists on source. If you want real backup rotation you need to rotate your destination dirs, deleting the one from 6 months ago. However, I really recommend using a proper tool as `rsnapshot`. – shodanshok Oct 13 '19 at 19:35
  • Thx again. Understanding what my own research hints at, too: This is difficult with native rsync. Not sure if rsnapshot really is what I need, either. But that is for different reasons. – Markus-Hermann Oct 15 '19 at 12:53
1

(not enough rep to comment, sadly)

I suspect rsnapshot would take far more space for an equivalent history, because it adds a new copy of the entire file each time there is a change.

rdiff-backup, on the other hand, keeps only the deltas, in what is basically the same efficiency that rsync itself gives over the network, translated to disk space.

To the original poster, I would suggest switching to something like borgbackup if this is a concern. Been very happy with it for some time now, lots of advantages over other systems (though I do often verify the backups by restoring and comparing, say once a month or so)