Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have 3 drives. For this purpose, we will call them A, B and C respectively.

A is 2 TB

B is 1 TB

C is 500 GB

I have already run

rsync -avz -progress A B

Now B is full and I want to move/copy what is not already on B from A to C

It really doesnt matter to me what happens to what is on A as I will reformat anyways.

share|improve this question
    
You want to move it, or you want to copy it? –  Flimzy Nov 30 '12 at 3:22
    
I just want to copy it. –  user1048138 Nov 30 '12 at 3:23

2 Answers 2

up vote 4 down vote accepted

Make a list of all the files on B, say with the the find command by going to that drive and running:

$ find . > files-on-b.xt

Then when you rsync from A to C, specify that list in the --exclude-from parameter:

$ rsync -avz --exclude-from=files-on-b.txt A C

You may need to futz with the prefixes in the list to makes sure it matches the format/relative directory that rsync is expecting from an exclude list. Always a good idea to run rsync with the -n option to see what it's about to do without actually doing it.

See rsync man page and this helpful blog post for more on --exclude-from.

share|improve this answer

You can make use of the --compare-dest option. This saves some time and space, as you don’t have to enumerate the whole contents of the first destination, and will work incrementally with many targets. Here’s how it works: After copying the contents from A to B, you run:

rsync -avz --compare-dest=/path/to/B /path/to/A/ /path/to/C/

rsync will use the contents of B to see what it has to transfer to C to make the copy of A complete. Anything which is already in B won’t be transferred. Note that absolute paths for --compare-dest are required, otherwise the path is taken as relative to the destination.

If you in any event have to split your destination further, you can compare to multiple previous targets by adding more --compare-dest arguments.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.