Rsync and BTRFS in Linux - Their differences ?

Timeshift works in two modes: Rsync mode and BTRFS mode. In the rsync mode, snapshots are taken using rsync and hard links, and common files are shared between the snapshots to save disk space.

In the BTRFS mode, snapshots are taken using the BTRFS file system. BTRFS is supported on only systems having an Ubuntu-type subvolume layout.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related backups, recovery, and cloning of disks procedures in Linux systems.

In this context, we shall look into the differences and benefits of Btrfs when using rsync for backups.


What is Rsync ?

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.

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.

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.


Examples of Rsync

1. Push Operation

Here is how push operation is performed using Rsync:

$ rsync local_file_path user@remote-host:remote_file_path

Here, we are pushing a local directory to a remote folder.

There is one more example of pulling a file or directory from a remote server to a local system.


2. Pull Operation

This operation takes the following form:

$ rsync admin@remote-host:remote_file_path local_file_path

Here, a user is simply pulling a remote file to a local machine creating a nice backup.


3. Save Some Bandwidth

If we were to save some bandwidth while creating local and remote backups. Rsync provides full control to perform such operations:

$ rsync -av -e ssh --max-size='1M' /src/ user@remote:/path/to/dst/

Here, we are clearly fetching only those files which are maximum of 1 MB size. This helps me avoid any large files available in my archives.


What does BTRFS mean ?

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:

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.

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.

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.


Examples of BTRFS 

As we already mentioned, 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.

BTRFS doesn't come preinstalled, so you will have to install it manually usually.

Once installed, you will have the opportunity to run BTRFS on your system.


1. Take a snapshot of the system

To do this, run the below command:

$ btrfs subvolume snapshot '/btrfs/SV1' in '/btrfs/SV1-snap'

This will create a subvolume snapshot of your complete file system volume.


2. Take a read-only snapshot of the system

You can run the below command:

$ btrfs subvolume snapshot –r '/btrfs/SV1' '/btrfs/SV1-rosnap'

It is evident that one program is copying whereas the other is creating storage blocks out of the available disks.


[Need assistance in performing backups and recovery of your Linux files ? We can help you. ]

This article covers how Rsync and BTRFS differ from each other. In fact, the really main difference is that RSYNC can create snapshots on an external disks. Not the same BTRFS. So, if your need is to prevent an unrecoverable crash of your hard disk, you must use RSYNC. After that using a live boot media (pendrive or DVD) you can install on the live boot media Timeshift and the restore your system from the external disk.

Related Posts