{"id":10118,"date":"2021-09-20T13:54:00","date_gmt":"2021-09-20T13:54:00","guid":{"rendered":"https:\/\/linuxways.net\/?p=10118"},"modified":"2021-09-20T13:54:00","modified_gmt":"2021-09-20T13:54:00","slug":"what-is-the-difference-between-rsync-and-btrfs-in-linux","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/what-is-the-difference-between-rsync-and-btrfs-in-linux\/","title":{"rendered":"What is the Difference Between Rsync and BTRFS in Linux?"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>Recently I covered a few topics on backups, recovery, and cloning of disks. Some of the readers came up with a few questions. One of them was that BTRFS and Rsync tries to backup using a tool like Grsync, Duplicity, or Timeshift. In this guide, we will discuss what are the technical differences between both and which one is better than the other. I am using Debian 10 Buster Edition for this guide. You don\u2019t need to also use the same.<\/p>\n<h2>Rsync<\/h2>\n<p>Rsync is a utility with small footprints on disk for backing up local and syncing remote files from servers to your local disk. Not only it supports both MBR and GPT partitions, but also covers several file systems like Ext4.<\/p>\n<p>When we take a backup using Rsync utility or using a third-party tool that works on top of Rsync, then common files are shared between the periodic backups. This helps to save enormous disk space.<\/p>\n<p>Rsync can save data anywhere. It means if you have a different file system on your external disk than your production system, Rsync will save the data on both. The greatest disadvantage of Rsync is that it is slightly slower than BTRFS.<\/p>\n<h2>Rsync Examples<\/h2>\n<h3><strong>Demo 1. Push Operation<\/strong><\/h3>\n<p>Here is how push operation is performed using Rsync:<\/p>\n<pre>$ rsync local_file_path user@remote-host:remote_file_path<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"616\" height=\"42\" class=\"wp-image-10119\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-299.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-299.png 616w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-299-300x20.png 300w\" sizes=\"auto, (max-width: 616px) 100vw, 616px\" \/><\/p>\n<p>In this example, we are pushing a local directory to a remote folder.<\/p>\n<p>There is one more demo of pulling a file or directory from a remote server to a local system.<\/p>\n<h3><strong>Demo 2. Pull Operation<\/strong><\/h3>\n<pre>$ rsync admin@remote-host:remote_file_path local_file_path<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"544\" height=\"47\" class=\"wp-image-10120\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-300.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-300.png 544w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-300-300x26.png 300w\" sizes=\"auto, (max-width: 544px) 100vw, 544px\" \/><\/p>\n<p>In this operation, a user is simply pulling a remote file to a local machine creating a nice backup.<\/p>\n<h3><strong>Demo 3. Save Some Bandwidth<\/strong><\/h3>\n<p>Now I have a concern here. I want to save some bandwidth while creating local and remote backups. Rsync provides full control to perform such operations.<\/p>\n<pre>$ rsync -av -e ssh --max-size='1M' \/src\/ user@remote:\/path\/to\/dst\/<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"715\" height=\"36\" class=\"wp-image-10121\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-301.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-301.png 715w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-301-300x15.png 300w\" sizes=\"auto, (max-width: 715px) 100vw, 715px\" \/><\/p>\n<p>In this example, I am clearly fetching only those files which are maximum of 1 MB size. This helps me avoid any large files available in my archives.<\/p>\n<h2>BTRFS<\/h2>\n<p>BTRFS stands for Better File System. Unlike Rsync, which is a program, BTRFS is a file system of its own. This is what makes the difference between them. Let us try to understand this with the following example:<\/p>\n<p>If you formatted your disk with the BTRFS files system instead of Ext3 or Ext4 then you will be able to use the BTRFS method to save your data on the same disk.<\/p>\n<p>Any backup taken using BTRFS saves time. It is faster because it is saving the data to a similar file system on Linux. If you do not have a BTRFS file system then you will have to create a BTRFS partition to keep your backups.<\/p>\n<p>If you have your system set up for BTRFS then it is better to use the BTRFS backup option whenever it comes. Rsync would disappoint you in this scenario.<\/p>\n<h3>BTRFS Examples<\/h3>\n<p>In the above discussion, we learned that BTRFS is not a backup system in context; rather it is a full-blown filesystem. Here is how to set it up on your device.<\/p>\n<p>BTRFS doesn\u2019t come preinstalled, so you will have to install it manually usually.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"535\" height=\"55\" class=\"wp-image-10122\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-302.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-302.png 535w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-302-300x31.png 300w\" sizes=\"auto, (max-width: 535px) 100vw, 535px\" \/><\/p>\n<p>Once installed, you will have the opportunity to run BTRFS on your system, for example:<\/p>\n<h4><strong>Example 1. Take a snapshot of the system<\/strong><\/h4>\n<pre>$ btrfs subvolume snapshot \u2018\/btrfs\/SV1\u2019 in \u2018\/btrfs\/SV1-snap\u2019<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"714\" height=\"46\" class=\"wp-image-10123\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-303.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-303.png 714w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-303-300x19.png 300w\" sizes=\"auto, (max-width: 714px) 100vw, 714px\" \/><\/p>\n<p>This will create a subvolume snapshot of your complete file system volume<\/p>\n<h4><strong>Example 2. Take a read-only snapshot of the system<\/strong><\/h4>\n<pre>$ btrfs subvolume snapshot \u2013r \u2018\/btrfs\/SV1\u2019 \u2018\/btrfs\/SV1-rosnap\u2019<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"764\" height=\"58\" class=\"wp-image-10124\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-304.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-304.png 764w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-304-300x23.png 300w\" sizes=\"auto, (max-width: 764px) 100vw, 764px\" \/><\/p>\n<p>Both of the examples show that one program is copying whereas the other is creating storage blocks out of the available disks.<\/p>\n<h2>Conclusion<\/h2>\n<p>In this guide, we discussed how Rsync and BTRFS differ from each other. One is a program to create backups and the other is a whole file system. I hope this clears the concept, and now you will be using both utilities in a much efficient way.<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction Recently I covered a few topics on backups, recovery, and cloning of disks. Some of the readers came up with a few questions. One of them was&hellip;<\/p>","protected":false},"author":1,"featured_media":10311,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4,5,83,165,2],"tags":[545,544],"class_list":["post-10118","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-debian","category-mint","category-opensuse","category-red-hat","category-ubuntu","tag-btrfs","tag-rsync"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/10118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=10118"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/10118\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/10311"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=10118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=10118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=10118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}