Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-03-2010, 09:34 PM   #1
Registered: Jan 2009
Location: Sydney, Australia
Distribution: Fedora,CentOS
Posts: 628

Rep: Reputation: 144Reputation: 144
rsync question

Hi, I run 3 systems with various flavours of Fedora. I have recently bought a USB HDD to back up my files. The idea is I will push the files across every week or so.

What I would like to do is take a bunch of files and only copy those which are not already in the storage area.

I am sure there must be a switch in rysnc which avoids duplicates but it is not leaping out at me. Can anyone help?
Old 12-03-2010, 10:02 PM   #2
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614
rsync does that by default.
Old 12-04-2010, 02:48 AM   #3
Registered: Jun 2004
Location: Northern CA
Distribution: Debian
Posts: 835

Rep: Reputation: 49
AlucardZero is right. The whole point of rsync is that it is efficient (on the network). It transfers no more than it must. If a file doesn't change, it doesn't update it. If a file does change, it only transfers the difference.

You might ask other questions, such as "What should be done when you delete a file from the source directory?" Do you want it deleted at the other end (--delete) or left alone?

Keep the man page handy. Rsync can be fun to use, but it has many options. Test your setup before you trust it.
Old 12-04-2010, 03:40 AM   #4
LQ Guru
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Read carefully the rsync options, from

man rsync
It explains it all in a lot of detail, so if you can't find something, check that you're not lazy on reading yes, it can be confusing too, but please do read it first, and when you don't understand some option(s), post them and ask. If you're interested in taking incremental backups on the same media, without losing space for non-changed files, check out the --link-dest=DIR option. Hard links don't cost you lots of space like "real" copies do, but allow you to get, for example, a directory hierarchy by date and time that allows for viewing "complete backups by time" instead of just a bunch of files that are "the newest". Sort of what OS X's Time Machine does.

When your rsync stuff is ready, test it and pay close attention to the results, to make sure it really does not re-transfer unchanged files. For example without the -u (--update) option rsync would copy files again and again even if they didn't change, but with it (after the first copy, if the original file does not change) the original file is older than the newer (which is created at the copy process), and causes rsync not to copy it until it changes (and thus becomes newer).
Old 12-04-2010, 04:27 AM   #5
Registered: Jun 2004
Location: Northern CA
Distribution: Debian
Posts: 835

Rep: Reputation: 49
Hard links will only work on a filesystem that supports them. You may need to reformat your drive if you want to take advantage of that advice.

b0uncer, either I'm not following what you're doing, or you've only described half of a very, very cool setup. Are you using the -b option somehow?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
rsync question mokku Linux - Newbie 1 05-31-2008 09:56 AM
rsync question mahmoud Linux - Software 5 04-25-2008 06:13 AM
rsync question hepburnenthorpe Linux - General 1 11-19-2006 06:19 PM
rsync question juanb Linux - General 10 01-28-2006 04:18 PM
rsync question kpachopoulos Linux - General 3 07-15-2005 04:33 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:02 PM.

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