-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday, 2013-05-06 at 21:36 -0400, Anton Aylward wrote:
Carl Hartung said the following on 05/06/2013 07:27 PM:
The biggest problem I had was figuring out that the last slash ('/') in the *source* path acts like a "container." From rsync's perspective, it determines at the outset what is (and is not) written to the target:
I think that is a learning hurdle for many people :-)
Absolutely O:-)
piping example:
rsync -rvn --delete /source/ /target | less
Does that tell you what its going to delete?
Yes, but mixed with the thousands of other things it does. And as there is no "--dry-run" above, by the time you notice it may be too late.
redirection example:
rsync -rvn --delete /source/ /target >somefilename.txt
--delete delete extraneous files from destination
Not the source? So what does that mean?
Not the source :-) Ok, I don't know the differences between the different variations of "delete" (after, during, etc). The important thing is that it deletes things in the target directory. What? An example is easier. Suppose you do a backup of a directory. Then you delete some files in the source directory, create new files, change other files - the typical use of a computer. A week later you do another backup of the same source and same target. Changed and new files will be copied to the destination, but the deleted files... what? They will simply remain in the backup copy. If you have to do a restore, it will be incorrect, because those files you deleted intentionally will be recovered. So what the delete option what it does is simply delete in the target directory those files from a previous backup that are no longer in the source directory. Ie, it ensures that both target and source contain the same things. Ok? :-)
Omitting '--delete' actually precludes true synchronization since this leaves items untouched at the target when they're not (i.e. are "no longer") present at the source. This is akin to an incremental backup, where items are added and updated, never deleted.
Or you could call it a 'copy' from source to destination. Everything from the source gets copied to the destination. If there is already stuff at the destination then its there and stays there. Call it "accumulation'.
Yes, but there is a better way - for backups. You can have a backup directory for week 1, another for week 2, etc. All of them contain only what was present at the time they were made, no more, no less. Deleted files during the week are in week_1 directory but not in week_2. So far, good, no? But this way you need to store several times the source directory, you need a lot of space. The trick is that those files that do not change during the week, instead of being copied again and again every week, instead a hard link is created. Ie, in week_2 say there is 'somefile' that is in fact a hard link to the same 'somefile' that is also in week_1. You don't get a file copied several times, you get a hardlink instead, saving a lot of space. There are scripts that handle this type of backups automatically, like "rsnapshot". But the functionality is that of "--link-dest" in rsync. Basically: rsync $OPTIONS --link-dest=$PREVIOUS $SOURCE/ $DESTINATION - -- Cheers, Carlos E. R. (from 12.1 x86_64 "Asparagus" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iEYEARECAAYFAlGIaRsACgkQtTMYHG2NR9U9VACdEdkbUiCVeOzgQRRN6AYevsNx JZ0AnA/WVYsRs9VaYKKwblhNAbmlHAkE =MSs7 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org