Ubuntu – Rsync two existing directories copying everything

automationbackuprsyncssh

I have two file servers in two locations. Currently both have the same data, which generally is unmodified (used for read only access).When the second server was set up (the one I'm sshing to) the data was copied over LAN and has since been moved geographically.

I'm trying to use rsync for the first time on the required directories. An example command;

sudo rsync -avz --ignore-existing -P --dry-run /media/Storage/OSs/ user@mydomain:/mnt/Storage/OSs/

I've tried using -c -t -u (Additionally went on the remote server and updated the timestamps to today) also but every time I execute a dry run it wants to copy everything!

Additionally the user is the same for both machines with the same UID.

*Edit

After playing around a bit more, I've found that rsync does not like the whitespace in the subdirectory names; For instance if I use ' to escape local shell & \ to escape remote shell

sudo rsync -avz –ignore-existing -P '/media/Storage/OSs/Windows/Windows server 2011/' 'user@mydomain:/mnt/Storage/OSs/Windows/Windows\ server\ 2011/'

Then all is well, my theory is then that rsync does not like the subdirectories with whitespaces. I have thousands of subdirectories; the only solution I can think of is to write a small python/shell script to run each sub directory separately but is undesirable.

Best Answer

Turns out I should have bitten the bullet... The dry run was just outputting the directories it explores but not the actual files.

I ran rsync for real and all was ok it skipped everything apart from the one or two new additions.

For reference this worked;

sudo rsync -avzs --ignore-existing --progress '/media/Storage/OSs/' 'User@MyDomain:/mnt/Storage/OSs/'
Related Question