LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-21-2009, 11:46 PM   #1
centguy
Member
 
Registered: Feb 2008
Posts: 627
Blog Entries: 1

Rep: Reputation: 48
How to make rsync right ?


Due to a first rsync "error" where I have two files with the
"same" name "Linux" and "linux", rsync always get confused when I do
subsequent rsync, even though I have merged Linux and linux and remove the redundant file. How can I ask rsync to forget the former mistakes ?


Quote:
mbp15$ rsync -avz name@centos52-64-fuj:/media/ext3-datadisk .
receiving file list ... done
ext3-datadisk/junk-summ/summary/man/linux
ext3-datadisk/junk-summ/summary/prog/quicksort.f
ext3-datadisk/junk-summ/summary/tex/eps/Si2-2x2x2-Conventional-UnitCell.agr
ext3-datadisk/junk-summ/summary/tex/eps/Si2-2x2x2-Conventional-UnitCell.eps
ext3-datadisk/summary/prog/068-Displace-TestForce-NRL-TB-01/75-Displace-TestForce-VASP-oddN1/IBZKPT

sent 1384 bytes received 1733053 bytes 495553.43 bytes/sec
total size is 28749153321 speedup is 16575.50


mbp15$ rsync -avz name@centos52-64-fuj:/media/ext3-datadisk .
receiving file list ... done
ext3-datadisk/junk-summ/summary/man/Linux
ext3-datadisk/junk-summ/summary/prog/quicksort.F
ext3-datadisk/junk-summ/summary/tex/eps/Si2-2x2x2-conventional-unitcell.agr
ext3-datadisk/junk-summ/summary/tex/eps/Si2-2x2x2-conventional-unitcell.eps
ext3-datadisk/summary/prog/068-Displace-TestForce-NRL-TB-01/75-Displace-TestForce-VASP-oddN1/ibzkpt

sent 574 bytes received 1748460 bytes 499724.00 bytes/sec
total size is 28749153321 speedup is 16437.16
 
Old 12-22-2009, 12:05 AM   #2
propofol
Member
 
Registered: Nov 2007
Location: Seattle
Distribution: Debian Wheezy & Jessie; Ubuntu
Posts: 334

Rep: Reputation: 60
You could add the "--delete" option to rsync. This will of course wipe out files that have been deleted in the source folders.
 
Old 12-22-2009, 12:38 AM   #3
centguy
Member
 
Registered: Feb 2008
Posts: 627

Original Poster
Blog Entries: 1

Rep: Reputation: 48
Thanks. I think --delete is a neat way to preserve identical content
between the source and the dest. Your "wipe out" actually means wiping out some files in the destination directory.

I did some simple tests, I still cannot explain the behavior I have
seen in the first post. I mean it should not happen since I have delete
one file from the source directory. Well, I think there is some weird things that is very subtle.
Anyway, I think from now on I will use --delete whenever I can.

Thanks!

Last edited by centguy; 12-22-2009 at 12:41 AM.
 
Old 12-22-2009, 02:18 AM   #4
centguy
Member
 
Registered: Feb 2008
Posts: 627

Original Poster
Blog Entries: 1

Rep: Reputation: 48
Now I figured out what went wrong !

My active directory is summary/

but I have another copy of that under junk-summ. I removed the redundancy in summary/, but not the ones in junk-summ, hence it created an illusion
that something is wrong with rsync. So rsync is working fine, of course!

At least I figured out the mystery, bummer!!

Another, the "--delete " is a good way of making identical copy, appreciate propofol's comment !
 
Old 12-22-2009, 08:52 AM   #5
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,681
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
The --delete option can also be dangerous. If you accidentally type the wrong source directory name, you could end up deleting all the target files (and have to reload everything all over again).

The --dry-run option is useful to test with to make sure you are doing what you think you are doing. Then recall the command and pull off the --dry-run option when ready to do it.

Something that often happens to people is that they run rsync a second time and find they have a duplicate file tree of their files inside the target directory, with a name the same as the directory. This is because rsync follows the legacy Unix behaviour of putting a source directory INSIDE a target directory when the target already exists. To make this not happen, simply append "/." to the source directory name. This causes rsync to access "." inside the target directory, which is the target itself. You can also use this trick on cp and scp commands.
 
Old 12-22-2009, 06:37 PM   #6
centguy
Member
 
Registered: Feb 2008
Posts: 627

Original Poster
Blog Entries: 1

Rep: Reputation: 48
Good pointer with dry-run!!


Quote:
The --delete option can also be dangerous. If you accidentally type the wrong source directory name, you could end up deleting all the target files (and have to reload everything all over again).
Very true, especially when important files that are supposed to be duplicated are
destroyed (such as months of simulation results and that is the only copy). It is also true with the basic cp.

Since I just learned rsync, I choose to alias the rsync command and intend to restrict the number of such
aliases.

I notice that between two machines with different rsync versions, it is
only possible to issue rsync command on the machine with a newer version.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using rsync to make your own Slackware mirror Laodiceans Slackware 4 12-19-2009 04:03 AM
Make rsync resume correctly... assasukasse Linux - Software 3 06-24-2008 03:59 PM
make an exception when doing rsync procfs Linux - General 9 08-10-2006 12:00 AM
make an exception when doing rsync procfs Linux - General 1 08-01-2006 06:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration