Editing Rsync
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | + | [[wikipedia:rsync|rsync]]<ref>http://man7.org/linux/man-pages/man1/rsync.1.html</ref> command is used to copy and synchronization files and folders. Rsync is a single thread C application that includes a progress indicator. | |
− | |||
− | |||
− | |||
== Configuration files == | == Configuration files == | ||
Line 8: | Line 5: | ||
== Options == | == Options == | ||
− | :<code>-W, --whole-file</code> | + | :<code>-W, --whole-file</code> |
− | :<code>-z, -- | + | :<code>-z, --compress</code> compresses the file data as it is sent to the destination machine using [[zlib]] compression library |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Basic commands == | == Basic commands == | ||
− | |||
− | |||
− | |||
* <code>rsync -P ORIGIN DESTINATION</code> | * <code>rsync -P ORIGIN DESTINATION</code> | ||
− | : <code>-P, --partial --progress | + | : <code>-P, --partial --progress</code>. --partial keep partially transferred files |
* Copy files from remote server to local machine: <code>rsync -chavzP --stats [email protected]:/path/to/copy /path/to/local/storage</code><ref>https://stackoverflow.com/questions/9090817/copying-files-using-rsync-from-remote-server-to-local-machine</ref> (explainshell<ref>https://explainshell.com/explain?cmd=rsync+-chavzP+--stats+user%40remote.host%3A%2Fpath%2Fto%2Fcopy+%2Fpath%2Fto%2Flocal%2Fstorage</ref>) | * Copy files from remote server to local machine: <code>rsync -chavzP --stats [email protected]:/path/to/copy /path/to/local/storage</code><ref>https://stackoverflow.com/questions/9090817/copying-files-using-rsync-from-remote-server-to-local-machine</ref> (explainshell<ref>https://explainshell.com/explain?cmd=rsync+-chavzP+--stats+user%40remote.host%3A%2Fpath%2Fto%2Fcopy+%2Fpath%2Fto%2Flocal%2Fstorage</ref>) | ||
: <code>-c, --checksum</code> option can slow transfers specially for large files | : <code>-c, --checksum</code> option can slow transfers specially for large files | ||
Line 37: | Line 21: | ||
: <code>--stats</code>, print statistics | : <code>--stats</code>, print statistics | ||
− | : | + | :-a, --archive. Equivalent to <code>-rlptgoD</code> |
− | :: | + | ::-r --recursive recurse into directoriees |
− | :: | + | ::-l --links copy symlinks as symlinks |
− | :: | + | ::-p --perms preserve permissions |
− | :: | + | ::-t --times preserve modification times |
− | :: | + | ::-g --group preserve group |
− | :: | + | ::-o --owner preserve owner (super-user only) |
− | :: | + | ::-D same as --devices --specials |
+ | |||
+ | |||
<pre>rsync -chavzP --stats [email protected]:/path/to/copy /path/to/local/storage | <pre>rsync -chavzP --stats [email protected]:/path/to/copy /path/to/local/storage | ||
Line 51: | Line 37: | ||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
* <code>rsync -av --ignore-existing src dst</code> | * <code>rsync -av --ignore-existing src dst</code> | ||
== Compression == | == Compression == | ||
rsync support [[compression]], but you can also compress your data with other external compression tools before using rsync. Such as [[bzip]], [[gzip]] or <code>[[xz]]</code> | rsync support [[compression]], but you can also compress your data with other external compression tools before using rsync. Such as [[bzip]], [[gzip]] or <code>[[xz]]</code> | ||
− | |||
− | |||
− | Compressing | + | Compressing using <code>[[xz]]</code><ref>https://linux.die.net/man/1/xz</ref> |
* <code>[[xz]] -v -T0 file_to_compress</code> | * <code>[[xz]] -v -T0 file_to_compress</code> | ||
− | :: | + | ::-v provides progress bar |
− | :: | + | ::-T0 use all available Threads, multi-threaded compression supported since 2014, version 5.2.0. <ref>https://git.tukaani.org/?p=xz.git;a=blob;f=NEWS;hb=HEAD</ref> |
== Activities == | == Activities == | ||
# Create a remote copy of your files for backup proposes using <code>rsync</code> | # Create a remote copy of your files for backup proposes using <code>rsync</code> | ||
# Read StackOverflow questions about rsync: https://stackoverflow.com/questions/tagged/rsync?tab=Votes | # Read StackOverflow questions about rsync: https://stackoverflow.com/questions/tagged/rsync?tab=Votes | ||
− | # Understand the differences between | + | # Understand the differences between [[linux/Basic commands/cp|cp]], [[scp]] and [[linux/Basic commands/rsync|rsync]]: https://stackoverflow.com/questions/20244585/how-does-scp-differ-from-rsync |
# Learn Effect of Trailing Slash / in rsync: https://www.alibabacloud.com/blog/speeding-up-network-file-transfers-with-rsync_594337 | # Learn Effect of Trailing Slash / in rsync: https://www.alibabacloud.com/blog/speeding-up-network-file-transfers-with-rsync_594337 | ||
# Learn use of <code>--inplace</code> (implies also <code>--partial</code>) for transferring large files and its important implications: http://man7.org/linux/man-pages/man1/rsync.1.html, also evaluate <code>-c, --checksum</code> impact on transfering large files | # Learn use of <code>--inplace</code> (implies also <code>--partial</code>) for transferring large files and its important implications: http://man7.org/linux/man-pages/man1/rsync.1.html, also evaluate <code>-c, --checksum</code> impact on transfering large files | ||
+ | # Learn about <code>-W, --whole-file</code> copy files whole (without delta-xfer algorithm), implications and usage cases such as not making a diff copy. | ||
# Learn about <code>--sparse</code> option and conflicts with <code>--inplace</code> | # Learn about <code>--sparse</code> option and conflicts with <code>--inplace</code> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== See also == | == See also == | ||
− | |||
* {{cp}} | * {{cp}} | ||
* <code>[[dd]]</code>, <code>[[mv]]</code> | * <code>[[dd]]</code>, <code>[[mv]]</code> |
Advertising: