{"id":2071,"date":"2015-05-19T08:33:24","date_gmt":"2015-05-19T08:33:24","guid":{"rendered":"https:\/\/cpanelplesk.com\/wp62\/?p=2071"},"modified":"2021-02-17T11:49:40","modified_gmt":"2021-02-17T11:49:40","slug":"using-rsync-to-synchronize-files","status":"publish","type":"post","link":"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/","title":{"rendered":"Using rsync to Synchronize Files:"},"content":{"rendered":"<p>Typically the word\u00a0 synchronize, in a information perspective, is used to mean the process of sharing information between resources (storage) to make sure that they are consistent. In fact, it\u2019s making sure that a copy of the information on one storage pool is replicated on a secondary storage pool.<!--more--><\/p>\n<p>Rsync (Remote Sync) is a most commonly used for duplicating and syncing files and internet directories remotely as well as locally in Linux systems. With the help of rsync control you can copy and connect your information remotely and locally across directories,disks and networks, perform data backups and reflecting between two linux system machines.<\/p>\n<p><strong>Some advantages and features of Rsync command:<\/strong><\/p>\n<p><strong>1.<\/strong> It effectively duplicates and synchronize data files to or from a remote system.<\/p>\n<p><strong>2.<\/strong> Supports duplicating links, devices, owners, categories and permissions.<\/p>\n<p><strong>3.<\/strong> It\u2019s quicker than scp (Secure Copy) because rsync uses remote-update method which allows to exchange just the variations between two places of data files.<\/p>\n<p><strong>4.<\/strong> At first it duplicates the whole content of a data file or a listing from source to location but from next time, it duplicates only the modified blocks and bytes to the destination.<\/p>\n<p><strong>5.<\/strong> Rsync takes in less bandwidth as it uses compression and decompression method while delivering and getting data at both ends.<\/p>\n<p><strong>Basic syntax of Rsync command:<\/strong><\/p>\n<div class=\"command-sh\">\n<pre class=\"lang:default decode:true \"># rsync options source destination<\/pre>\n<\/div>\n<p><strong>Install rsync in your Linux machine:<\/strong><\/p>\n<p>While logged on as root, install rsync by executing the following command<\/p>\n<div class=\"command-sh\">\n<pre class=\"lang:default decode:true \">yum -y install rsync<\/pre>\n<\/div>\n<p><strong>Using rsync to Synchronize Files from the Local server to a Remote server:<\/strong><\/p>\n<p>This command will sync a directory from a local machine to a remote machine. For example: There is a folder in your local server \u201crsynctest\u201d which contains some files.<\/p>\n<div class=\"cpanel-files\"><\/div>\n<pre class=\"lang:default decode:true \">rsync -avze ssh  rsynctest\/ root@192.168.10.200:\/home\/<\/pre>\n<div class=\"space1\"><\/div>\n<p><strong>Copy\/Sync a Remote Directory to a Local Machine:<\/strong><\/p>\n<p>This command will help you to sync a remote directory to a local directory. Here in this example, a directory\/home\/cpanelp\/rsynctest which is on a remote server is being copied in your local computer in \/tmp\/backup.<\/p>\n<div class=\"command-sh\">\n<pre class=\"lang:default decode:true \">rsync -avzhe ssh  root@192.168.10.201:\/home\/cpanelp\/rsynctest \/tmp\/backup<\/pre>\n<\/div>\n<p><strong>Show Progress While Transferring Data with rsync:<\/strong><\/p>\n<p>To show the progress while transferring the data from one machine to a different machine, we can use \u2018\u2013progress\u2019 option for it. It displays the files and the time remaining to complete the transfer.<\/p>\n<div class=\"command-sh\">\n<pre class=\"lang:default decode:true\">rsync -avzhe ssh --progress \/rsynctest root@192.168.10.1200:\/home\/<\/pre>\n<\/div>\n<p><strong>Use of \u2013include and \u2013exclude Options:<\/strong><\/p>\n<p>These two options allows us to include and exclude files by specifying parameters, These options helps us to specify those files or directories which we want to include in our sync and exclude files and folders which we don\u2019t want to be transferred.<\/p>\n<div class=\"command-sh\">\n<pre class=\"lang:default decode:true \">sync -avze ssh --include 'R*' --exclude '*' root@192.168.10.200:\/var\/lib\/rpm\/ \/root\/rpm<\/pre>\n<\/div>\n<p><strong>Set the Max Size of Files to be Transferred:<\/strong><\/p>\n<p>We can specify the Max file size to be transferred or sync. We can do it with \u201c\u2013max-size\u201d option.<\/p>\n<div class=\"cpanel-files\"><\/div>\n<pre class=\"lang:default decode:true \">rsync -avzhe ssh --max-size='200k' \/var\/lib\/rpm\/ root@192.168.10.200:\/root\/tmpcr<\/pre>\n<div class=\"space1\"><\/div>\n<p>So this command will transfer only those files which are equal or smaller than 200k.<\/p>\n<p><strong>Automatically Delete source Files after successful Transfer:<\/strong><br \/>\nNow, assume you have a main web server and a data back-up server, you created a daily back-up and synced it with your back-up server, now you don\u2019t want to keep that local duplicate of back-up in your web server.<\/p>\n<p>So, you don&#8217;t need to wait around for exchange to complete and then eliminate those local back-up data file manually. This automated removal can be done using \u2018\u2013remove-source-files\u2018 option.<\/p>\n<div class=\"cpanel-files\"><\/div>\n<pre class=\"lang:default decode:true \">rsync --remove-source-files -zvh backup.tar \/home\/backups\/<\/pre>\n<div class=\"space1\"><\/div>\n<p><strong>Do a Dry Run with rsync:<\/strong><\/p>\n<p>If you are a beginner and using rsync and don\u2019t know what exactly your command going to do. Rsync could really ruin the things in your destination directory and then doing an reverse can be a boring job.<\/p>\n<p>Use of this choice will not create any changes only do a dry run of the command and reveals the outcome, if the outcome is exactly same you want to do then you can eliminate \u2018\u2013dry-run\u2018 option from your command and run on the terminal.<\/p>\n<div class=\"command-sh\">\n<pre class=\"lang:default decode:true \">rsync --dry-run --remove-source-files -zvh backup.tar \/tmp\/backups\/<\/pre>\n<\/div>\n<p>That\u2019s all with Rsync.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Typically the word\u00a0 synchronize, in a information perspective, is used to mean the process of sharing information between resources (storage) to make sure that they are consistent. In fact, it\u2019s making sure that a copy of the information on one storage pool is replicated on a secondary storage pool. [&#8230;]<\/p>\n<p><a class=\"understrap-read-more-link\" href=\"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/\">Continue Reading&#8230;<\/a><\/p>\n","protected":false},"author":2,"featured_media":2073,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2071","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cpanel"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using rsync to Synchronize Files: - cPanel Plesk<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Using rsync to Synchronize Files: - cPanel Plesk\" \/>\n<meta name=\"twitter:description\" content=\"Typically the word\u00a0 synchronize, in a information perspective, is used to mean the process of sharing information between resources (storage) to make sure that they are consistent. In fact, it\u2019s making sure that a copy of the information on one storage pool is replicated on a secondary storage pool. [...]Continue Reading...\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2015\/05\/Rsync.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Seemab Saleem\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/\"},\"author\":{\"name\":\"Seemab Saleem\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/73d573cc7eaaf6625cf0dbd72191a648\"},\"headline\":\"Using rsync to Synchronize Files:\",\"datePublished\":\"2015-05-19T08:33:24+00:00\",\"dateModified\":\"2021-02-17T11:49:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/\"},\"wordCount\":636,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13\"},\"image\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2015\/05\/Rsync.jpg\",\"articleSection\":[\"Cpanel\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/\",\"url\":\"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/\",\"name\":\"Using rsync to Synchronize Files: - cPanel Plesk\",\"isPartOf\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2015\/05\/Rsync.jpg\",\"datePublished\":\"2015-05-19T08:33:24+00:00\",\"dateModified\":\"2021-02-17T11:49:40+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/#primaryimage\",\"url\":\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2015\/05\/Rsync.jpg\",\"contentUrl\":\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2015\/05\/Rsync.jpg\",\"width\":225,\"height\":225},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cpanelplesk.com\/wp62\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using rsync to Synchronize Files:\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#website\",\"url\":\"https:\/\/cpanelplesk.com\/wp62\/\",\"name\":\"cPanel Plesk\",\"description\":\"Blog on famous hosting control panels\",\"publisher\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cpanelplesk.com\/wp62\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13\",\"name\":\"Farooq Omer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2020\/11\/cpanelplesk.png\",\"contentUrl\":\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2020\/11\/cpanelplesk.png\",\"width\":300,\"height\":44,\"caption\":\"Farooq Omer\"},\"logo\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/73d573cc7eaaf6625cf0dbd72191a648\",\"name\":\"Seemab Saleem\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6a87ff2e53b03e6839250e5278a6bd46?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6a87ff2e53b03e6839250e5278a6bd46?s=96&d=mm&r=g\",\"caption\":\"Seemab Saleem\"},\"description\":\"Linux Server Administrator, Web Hosting engineer. I'm dealing with Linux servers since 2014. I started this blog to share the work i love with the world . let me know if you need any assistance. Thanks!!\",\"sameAs\":[\"https:\/\/cpanelplesk.com\/wp62\"],\"url\":\"https:\/\/cpanelplesk.com\/wp62\/author\/cmb\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using rsync to Synchronize Files: - cPanel Plesk","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/","twitter_card":"summary_large_image","twitter_title":"Using rsync to Synchronize Files: - cPanel Plesk","twitter_description":"Typically the word\u00a0 synchronize, in a information perspective, is used to mean the process of sharing information between resources (storage) to make sure that they are consistent. In fact, it\u2019s making sure that a copy of the information on one storage pool is replicated on a secondary storage pool. [...]Continue Reading...","twitter_image":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2015\/05\/Rsync.jpg","twitter_misc":{"Written by":"Seemab Saleem","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/#article","isPartOf":{"@id":"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/"},"author":{"name":"Seemab Saleem","@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/73d573cc7eaaf6625cf0dbd72191a648"},"headline":"Using rsync to Synchronize Files:","datePublished":"2015-05-19T08:33:24+00:00","dateModified":"2021-02-17T11:49:40+00:00","mainEntityOfPage":{"@id":"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/"},"wordCount":636,"commentCount":0,"publisher":{"@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13"},"image":{"@id":"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/#primaryimage"},"thumbnailUrl":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2015\/05\/Rsync.jpg","articleSection":["Cpanel"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/","url":"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/","name":"Using rsync to Synchronize Files: - cPanel Plesk","isPartOf":{"@id":"https:\/\/cpanelplesk.com\/wp62\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/#primaryimage"},"image":{"@id":"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/#primaryimage"},"thumbnailUrl":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2015\/05\/Rsync.jpg","datePublished":"2015-05-19T08:33:24+00:00","dateModified":"2021-02-17T11:49:40+00:00","breadcrumb":{"@id":"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/#primaryimage","url":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2015\/05\/Rsync.jpg","contentUrl":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2015\/05\/Rsync.jpg","width":225,"height":225},{"@type":"BreadcrumbList","@id":"https:\/\/cpanelplesk.com\/wp62\/using-rsync-to-synchronize-files\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cpanelplesk.com\/wp62\/"},{"@type":"ListItem","position":2,"name":"Using rsync to Synchronize Files:"}]},{"@type":"WebSite","@id":"https:\/\/cpanelplesk.com\/wp62\/#website","url":"https:\/\/cpanelplesk.com\/wp62\/","name":"cPanel Plesk","description":"Blog on famous hosting control panels","publisher":{"@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cpanelplesk.com\/wp62\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13","name":"Farooq Omer","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/","url":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2020\/11\/cpanelplesk.png","contentUrl":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2020\/11\/cpanelplesk.png","width":300,"height":44,"caption":"Farooq Omer"},"logo":{"@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/"}},{"@type":"Person","@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/73d573cc7eaaf6625cf0dbd72191a648","name":"Seemab Saleem","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6a87ff2e53b03e6839250e5278a6bd46?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6a87ff2e53b03e6839250e5278a6bd46?s=96&d=mm&r=g","caption":"Seemab Saleem"},"description":"Linux Server Administrator, Web Hosting engineer. I'm dealing with Linux servers since 2014. I started this blog to share the work i love with the world . let me know if you need any assistance. Thanks!!","sameAs":["https:\/\/cpanelplesk.com\/wp62"],"url":"https:\/\/cpanelplesk.com\/wp62\/author\/cmb\/"}]}},"_links":{"self":[{"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/posts\/2071","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/comments?post=2071"}],"version-history":[{"count":0,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/posts\/2071\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/media\/2073"}],"wp:attachment":[{"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/media?parent=2071"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/categories?post=2071"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/tags?post=2071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}