Search code examples
terminalsyntaxrsync

rsync over ssh results in 0 files, but no error message


I'm trying to rsync a large directory of around 200 GB from a server to my local external hard drive. I can ssh onto the server and see the directory fine. I can also cd into the external hard drive fine. When I try and rsync the file across, I don't get an error, but the last line of the rsync output is 'total size is 0 speedup is 0.00', and there are no files in the destination directory.

Here's how I ssh onto the server successfully:

ssh [email protected]

Here's my rsync command:

rsync -avrt -progress -e "ssh [email protected]:/mnt/gpfs/live/rd01__/ritd-ag-project-rd012x-smmca23/" "/Volumes/DUAL DRIVE/ONP/2022.08.10_results/"

And here's the rsync output:

sending incremental file list
drwxrwxrwx         65,536 2022/08/10 21:32:06 .

sent 57 bytes  received 64 bytes  242.00 bytes/sec
total size is 0  speedup is 0.00

What am I doing wrong?


Solution

  • The way you have it quoted, the source path is part of the remote shell option (-e value) rather than a separate argument as it should be.

    rsync -avrt -progress -e "ssh [email protected]:/mnt/gpfs/live/rd01__/ritd-ag-project-rd012x-smmca23/" "/Volumes/DUAL DRIVE/ONP/2022.08.10_results/"
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                              This is all part of the `-e` option value
    

    This means rsync doesn't see that as a sync source at all, but just part of the command it'll use to connect to the remote system. I'm not sure why this doesn't lead to an error. In any case, the fix is simple: don't include ssh with the source path.

    As I noticed later (see comments) the --progress option needs a double-dash or it'll be wildly misparsed. Fixing both of these things gives:

    rsync -avrt --progress -e ssh "[email protected]:/mnt/gpfs/live/rd01__/ritd-ag-project-rd012x-smmca23/" "/Volumes/DUAL DRIVE/ONP/2022.08.10_results/"
    

    In fact, since ssh is the default command for making a remote connection, you can leave off -e ssh entirely:

    rsync -avrt --progress "[email protected]:/mnt/gpfs/live/rd01__/ritd-ag-project-rd012x-smmca23/" "/Volumes/DUAL DRIVE/ONP/2022.08.10_results/"