useful rsync option not in grsync

Story: 5 “lightweight” backup solution for Linux desktopTotal Replies: 0
Author Content

Jan 06, 2013
9:53 PM EDT
For those not wanting to use a gui (to script something, maybe), there's also the following.

I checked the latest version of grsync to see if this option was available from the gui, and didn't see it (it may be there, though).

The option --link-dest=/dir/to/check tells rsync to check /dir/to/check for files that haven't changed compared to the source, and make hardlinks from the destination directory to /dir/to/check for files that haven't changed on the source. This is useful for making incremental backups. For example:

rsync -a /source/dir /path/to/Backups/Day1

would create the initial backup. The following day, you'd run

rsync -a /source/dir --link-dest=/path/to/Backups/Day1 /path/to/Backups/Day2

This will copy over files that have changed in /source/dir from /source/dir to /path/to/Backups/Day2, but for files that haven't changed, a hardlink is made in /path/to/Backups/Day2 to the file in /path/to/Backups/Day1. You can then continue on with Day3, Day4, etc. (the "date" and "cron" commands can automate this nicely in a simple script).

The advantage of this is that you can go back to any point in time, just by copying from DayWhatever to restore the backup. Additionally, you can remove old backups (say Day1), but since the future backups have hardlinked files, none of the data still in "use" is actually removed.

Admittedly, I am not a developer/programmer/sysadmin, so this may be unduly "hacky". I enjoyed this approach since it makes use of a single tool (rsync), and it was one I was already using fairly regularly. Suggestions/improvements appreciated!

Posting in this forum is limited to members of the group: [ForumMods, SITEADMINS, MEMBERS.]

Becoming a member of LXer is easy and free. Join Us!