I'm currently using rsync and --link-dest to give me something like a poor-man's incremental snapshot to disk. But I really only want to generate a new backup if rsync detects differences, otherwise I don't need a new backup. Currently I do something like this: rsync -a --delete --link-dest=../backup.previous/ source/ backup.next/ diff -r backup.previous backup.next && rm -r backup.next Is there a way to tell rsync to not even bother creating backup.next if there are no differences? It looks like --compare-dest will also recreate the directory structure when there are no differences. The closest I can come up with other than cleaning up after the fact is first running rsync with -n --stats and conditionally running rsync again if the output from the first run indicates new files (which doesn't account for deletions). It seems there should be a better/cleaner way but I haven't found it from the man pages. I'm currently using rsync 2.6.9. Is it possible to make rsync perform --link-dest if and only if it detects differences? Thanks for any guidance, ~ Daniel -------------- next part -------------- HTML attachment scrubbed and removed
Maybee somone has a better approach than the "--dry-run " option?
On Thu, 2008-11-13 at 16:17 -0500, Daniel Jarboe wrote:> I'm currently using rsync and --link-dest to give me something like a > poor-man's incremental snapshot to disk. But I really only want to > generate a new backup if rsync detects differences, otherwise I don't > need a new backup. > > Currently I do something like this: > > rsync -a --delete --link-dest=../backup.previous/ source/ > backup.next/ > diff -r backup.previous backup.next && rm -r backup.next > > Is there a way to tell rsync to not even bother creating backup.next > if there are no differences? It looks like --compare-dest will also > recreate the directory structure when there are no differences. The > closest I can come up with other than cleaning up after the fact is > first running rsync with -n --stats and conditionally running rsync > again if the output from the first run indicates new files (which > doesn't account for deletions).I don't believe there is any better way than the two you have suggested: run and delete if there were no changes, or check first with -n. Note that with the first approach, you don't need a separate diff command; you can just use -i and check whether the itemize output is nonempty. Matt
On 13-Nov-2008, at 14:17, Daniel Jarboe wrote:> I'm currently using rsync and --link-dest to give me something like a > poor-man's incremental snapshot to disk. But I really only want to > generate > a new backup if rsync detects differences, otherwise I don't need a > new > backup.But with link-dest you are not creating a new backup; you are only creating new LINKS to the same backup. If the new backup has no changes from the last backup, it takes up no space, so why does it matter? You simply expire your old backup off automatically with a rotate script. Here's what my backup folder looks like: 2 drwxr-xr-x 23 root wheel 1024 Nov 14 00:54 serv1.daily.0 2 drwxr-xr-x 23 root wheel 1024 Nov 13 01:05 serv1.daily.1 2 drwxr-xr-x 23 root wheel 1024 Nov 12 00:57 serv1.daily.2 2 drwxr-xr-x 23 root wheel 1024 Nov 11 00:58 serv1.daily.3 2 drwxr-xr-x 23 root wheel 1024 Nov 10 00:58 serv1.daily.4 2 drwxr-xr-x 23 root wheel 1024 Nov 9 00:55 serv1.daily.5 2 drwxr-xr-x 23 root wheel 1024 Nov 8 00:56 serv1.daily.6 2 drwxr-xr-x 24 root wheel 1024 Oct 1 00:21 serv1.monthly.0 2 drwxr-xr-x 24 root wheel 1024 Sep 1 00:22 serv1.monthly.1 2 drwxr-xr-x 24 root wheel 1024 Aug 1 00:22 serv1.monthly.2 2 drwxr-xr-x 24 root wheel 1024 Jul 1 00:21 serv1.monthly.3 2 drwxr-xr-x 24 root wheel 1024 Jun 1 00:22 serv1.monthly.4 2 drwxr-xr-x 24 root wheel 1024 May 1 00:27 serv1.monthly.5 2 drwxr-xr-x 23 root wheel 1024 Nov 15 00:52 serv1.sday.0 2 drwxr-xr-x 23 root wheel 1024 Nov 14 18:55 serv1.sday.1 2 drwxr-xr-x 23 root wheel 1024 Nov 14 12:58 serv1.sday.2 2 drwxr-xr-x 23 root wheel 1024 Nov 14 06:53 serv1.sday.3 2 drwxr-xr-x 23 root wheel 1024 Nov 1 00:51 serv1.weekly.0 2 drwxr-xr-x 23 root wheel 1024 Oct 25 00:51 serv1.weekly.1 2 drwxr-xr-x 23 root wheel 1024 Oct 18 00:52 serv1.weekly.2 2 drwxr-xr-x 23 root wheel 1024 Oct 11 00:48 serv1.weekly.3 sday.3 becomes daily.0 and daily.6 becomes weekly.0 and weekly.3 becomes monthly.0 -- Please to meet you, Rose. Now run for your life!
Reasonably Related Threads
- [Bug 2947] stdout with [-v] -H --link-dest and slink/sock/fifo/regf
- Fwd: rsync 3.0.9 partial file left after CTRL-C WITHOUT using --partial
- [Bug 8450] New: --link-dest seems not to work mounted NTFS file systems
- make installworld Error code 64
- nut package with Riello UPS support