3

I had one 8TB hard drive to back up my stuff and rsync'ing that was easy. Now that my hoard has outgrown 8TB i bought another 8TB drive.

My question is, how can I tell rsync to only sync files to the second drive that are not on the first drive?

I tried creating a file list with

cd /q/backup; find -type f > /oldbackup.txt

which creates a file looking like

./a/Dir/file1
./a/Dir/file2
./b/elsewhere/thing
./...
...

and then use it like

rsync -rvu --delete --exclude-from=/oldbackup.txt /x/live/a /x/live/b /r/backup/

but rsync still copied all files, seemingly ignoring the exclude list.

How do I get this to work?

Also, am I correct in assuming, that even if it worked, it would leave a lot of empty directories on the new backup?

3

Yes, the problem (at least in my case) seemed to be two things:

  • the leading ./ needed to be removed; rsync expects excludes to be specified either in an absolute manner or relative to the source directory.
  • literal file names needed to be escaped against regular expression syntax to avoid rsync trying to interpret them as an expression.

And yes, I did end up with a bunch of empty directories, but a script to delete empty directories is an adventure for another time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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