Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

    • Archives

    • Recent comments

    Resume broken scp/mc/fish transfer with rsync

    17th October 2013

    Note: this is a draft post back from 2010. As it is still useful to me, I’ve decided to publish it as is.

    I had already mused on the powers of rsync before.

    This time, a reminder to self on how to resume copying broken scp/mc/fish transfers, using rsync.

    First, an assortment of example commands.
    export RSYNC_RSH=ssh
    rsync --partial file_to_transfer user@remotehost:/path/remote_file
    rsync -av --partial --progress --inplace SRC DST
    rsync --partial --progress --rsh=ssh host:/work/source.tar.bz2 .
    rsync --partial --progress --rsh=ssh -r ./

    One could also try the --append option of rsync to base the transfer resumption on the sizes of the two files rather than verifying that their contents match.

    Now a single command line explained in a little more details:
    rsync -vrPtz -e ssh host:/remote_path/* /local_path/
    -e ssh rsync will use ssh client instead of rsh, which makes data exchange encrypted
    -z compress file transfer
    -t preserve time (other attributes, such as owner and permissions are also possible)
    -P resume incomplete file transfer
    -r recurse into subdirectories
    -v verbose

    To specify a port when using ssh you must add it to the ssh command.
    Example: rsync --partial --progress --rsh="ssh -p 16703" user@host:path


    Leave a Reply

    XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>