Is rsync not supposed to append to the existing files or just copy over them?
I would like to update /home/bobg/.thunderbird but the following simply overwrites everything:
[root@box10 bobg]# rsync -avz /mnt/HOME1/bob/TBdBx07/ /home/bobg/.thunderbird/
In this case I have rsynced .thunderbird from box7 to an nfs server file TBdBx07 and am in turn applying that to box10. I also want to do the same with F20-Beta in Vmware Workstion which is how I got off on this ...
Do I misunderstand or am I simply doing it wrong?
Bob
On 11/15/2013 09:17 AM, Bob Goodwin - Zuni, Virginia, USA issued this missive:
Is rsync not supposed to append to the existing files or just copy over them?
I would like to update /home/bobg/.thunderbird but the following simply overwrites everything:
[root@box10 bobg]# rsync -avz /mnt/HOME1/bob/TBdBx07/ /home/bobg/.thunderbird/
In this case I have rsynced .thunderbird from box7 to an nfs server file TBdBx07 and am in turn applying that to box10. I also want to do the same with F20-Beta in Vmware Workstion which is how I got off on this ...
Do I misunderstand or am I simply doing it wrong?
No, you're not misunderstanding it. rsync looks at the source and target and if there are differences, it copies from the source to the target. In your case, you told rsync to copy everything inside the /mnt/HOME1/bob/TBdBx07 directory (the source) to the /home/bobg/.thunderbird directory (the target). If there are differences between those two directories, rsync will try to make the target look like the source as much as possible. Unless you add the "-u" option, rsync will even overwrite files on the target that are "newer" than those on the source.
The "-a" option to rsync tells it to try to do an archive (keep all attributes, recurse down directories, etc.) and the "-z" means "compress data during the transfer" (sorta silly when everything's on the same LAN...it's more intended for WAN use). You probably wanted "-avu --ignore-existing" to keep rsync from overwriting existing files on the target (rsync will only copy over files that do NOT exist on the target).
rsync is a very powerful tool, but as with all powerful tools, one can easily injure oneself. Use adequate safety equipment and read the manual! :-) ---------------------------------------------------------------------- - Rick Stevens, Systems Engineer, AllDigital ricks@alldigital.com - - AIM/Skype: therps2 ICQ: 22643734 Yahoo: origrps2 - - - ----------------------------------------------------------------------
On 15/11/13 12:53, Rick Stevens wrote:
No, you're not misunderstanding it. rsync looks at the source and target and if there are differences, it copies from the source to the target. In your case, you told rsync to copy everything inside the /mnt/HOME1/bob/TBdBx07 directory (the source) to the /home/bobg/.thunderbird directory (the target). If there are differences between those two directories, rsync will try to make the target look like the source as much as possible. Unless you add the "-u" option, rsync will even overwrite files on the target that are "newer" than those on the source.
The "-a" option to rsync tells it to try to do an archive (keep all attributes, recurse down directories, etc.) and the "-z" means "compress data during the transfer" (sorta silly when everything's on the same LAN...it's more intended for WAN use). You probably wanted "-avu --ignore-existing" to keep rsync from overwriting existing files on the target (rsync will only copy over files that do NOT exist on the target).
rsync is a very powerful tool, but as with all powerful tools, one can easily injure oneself. Use adequate safety equipment and read the manual! :-)
Ok that appears to have done what I wanted, at least it transferred a lot less data in very little time. I thank you for the clear explanation. I have trouble understanding the man pages but on a good day I do answer my own questions.
Thanks,
Bob
On 15Nov2013 17:19, Bob Goodwin bobgoodwin@wildblue.net wrote:
Ok that appears to have done what I wanted, at least it transferred a lot less data in very little time.
One thing I think Rick may have missed out is that if a file is similar on the target (eg it had just grown on the source, implying "append" to the target) then while rsync will make a whole new target file (as a temp file until it is complete) it just sends checksums for the overlapping data; if the checksums match then the data in the new temp files is copied from the existing target to the temp file. Only different data is sent from the source. Once complete, the temp file is switched in to replace the former target file.
Cheers,