LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-29-2012, 11:33 AM   #1
Steve W
Member
 
Registered: Mar 2007
Distribution: Linux Mint 18.1
Posts: 520

Rep: Reputation: 44
rsync or similar to backup to two different targets


Currently, I have lot of files on one 32GB source. I want to back these up to two 16GB target drives. Many of the files are already on the target drives, and don't need to be recopied. However, I only want one backup copy of each file, but it could be on either drive.

Is there an option in rsync, or other package, that could run through each file on the source drive, checking both targets and copying the file to (either) target if it is not present, but ignoring if it is?
 
Old 11-30-2012, 01:37 AM   #2
bala.linuxtech
Member
 
Registered: Nov 2012
Location: Bangalore
Distribution: RHEL and Centos
Posts: 86

Rep: Reputation: Disabled
Quote:
Originally Posted by Steve W View Post
Currently, I have lot of files on one 32GB source. I want to back these up to two 16GB target drives. Many of the files are already on the target drives, and don't need to be recopied. However, I only want one backup copy of each file, but it could be on either drive.

Is there an option in rsync, or other package, that could run through each file on the source drive, checking both targets and copying the file to (either) target if it is not present, but ignoring if it is?
Hi Steve

Rsync is good option for this Process ., Rsync always copies changed files or nodes only .

use this way

#rsync <options> <Source> <yr_Destination>

Options :

-a : archive

-u : cant modify at the destination

-v : Verbose mode

-z : Compress


Do your best !

Regards
Bala.Linuxtech
 
Old 11-30-2012, 10:44 AM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
One way would be to make a list of all the files on target2, then do an rsync to target1 using the "--exclude-from=" option to exclude all the files that already exist on target2. Without knowing what your directory structures look like it's hard to give precise instructions, but here's the general idea:
Code:
find /path/to/target2 -type f -printf '%P\n' >/tmp/t2files.txt
rsync -a --exclude-from=/tmp/t2files.txt /path/to/sourcedir/ /path/to/target1
rsync -a --existing /path/to/sourcedir/ /path/to/target2
The find command stores all the paths to files on target2 (without the leading "/path/to/target2") on the temp file. The first rsync skips all of the previously found files. The second rsync updates only the files that already exist on target2.

Note that the trailing "/" on "/path/to/sourcedir/" is significant and causes rsync to copy the contents of the source directory and not the directory name. If the directory name itself is replicated on the target, then you should omit that trailing "/".

You should try this first using the "-n" (--dry-run) and "-v" (--verbose) options on the rsync commands to make sure it's all working as expected.

This obviously breaks down if all of the new files won't fit on target1, but you did say "(either) target".
 
1 members found this post helpful.
Old 11-30-2012, 03:57 PM   #4
Steve W
Member
 
Registered: Mar 2007
Distribution: Linux Mint 18.1
Posts: 520

Original Poster
Rep: Reputation: 44
Okay, that's given me something to think about. Thanks.
 
  


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
LXer: Rsync Backup for Windows, Linux Knoppix, and Other Smart Technologies in Handy Backup by Novos LXer Syndicated Linux News 0 12-24-2011 11:43 AM
LXer: Backup with rsync and rsync.net LXer Syndicated Linux News 0 09-14-2010 04:20 PM
Faster LVM Backup using partimage or similar kdingo Linux - Server 0 07-21-2008 11:00 AM
Using RSync to backup a secondary off-site backup server pezdspencer Linux - Software 4 06-29-2007 03:40 PM
Using rsync to backup data. Best way to backup folders? Micro420 Linux - General 2 11-23-2006 01:13 AM

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

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

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