rsync

From one Folder to another Folder (Content only)

rsync -a <SOURCE_FOLDER>/ <DEST_FOLDER>/

One Remotefolder content into destination Folder (can be ./)

rsync -a <USERNAME>@Server:/<SOURCE_FOLDER>/* <DEST_FOLDER>/
rsync out of Memory

When syncing a lot of files, rsync build a large file-cache in memory. This can go thus far, that the system is swaping and will become unresponsable. To limit the file-caching avild the -H-paraemeter and use:

--no-inc-recursive

Idea of parallel rsync

The following command can be used to run rsync over multiple threads in parallel. This can tremendously speedup file copy from one disk or computer node on a network to the next.

In the example below, the main variables used are:

$thread=24 โ€“ Use 24 threads. Adjust this depending on the capacity of the systems involved. Set to 0 for xargs to maximize this value.

$src=/src/ โ€“ This represents the source path of the directory of contents you wish to copy. It's important to pay attention to the ending /.

$dest=/dest/ โ€“ This is the destination path for the files to be copied.

$threads=24; $src=/src/; $dest=/dest/ rsync -aL -f"+ */" -f"- *" $src $dest && (cd $src && find . -type f | xargs -n1 -P$threads -I% rsync -az % $dest/% )
Log In