Recover HDD Data
 
Blog
 
The Btrfs file system

The Btrfs file system

The Linux operating system supports a wide range of file systems. In this article, we will discuss the advantages and disadvantages of using the Btrfs file system.

Contents:

  1. What is the Btrfs file system?
  2. The Btrfs file system features
  3. The Btrfs file system structure
  4. The main disadvantages of the Btrfs file system
  5. Btrfs file system recovery features
  6. How to open a Btrfs drive in Windows?
  7. The best alternatives to the Btrfs file system?

What is the Btrfs file system?

Btrfs is a relatively new file system for UNIX-like operating systems which has many modern features and provides high performance at the same time.

The Btrfs file system was originally developed as an alternative to ZFS. The reason is that ZFS is developed by SunMicrosystems and is therefore distributed on a proprietary basis. It is contrary to the Linux philosophy, which is available free of charge. The main goal was to bridge the many weaknesses that Linux filesystems had and make the Btrfs administration as easy as possible.

The first version of the Btrfs file system dates back to 2007. It was introduced by Oracle. Like many other file systems, Btrfs used block addresses to store information. However, the metadata structure storing block addresses was organized in the form of B-trees.

The most important innovation was that now when changes are made to the file – not the whole file is changed, but only the part that contains the changes.

The use of the B-tree allows you to implement the “copy-on-write” method, which is based on using a copy of all data blocks when reading information. Due to this approach, the performance of the file system is greatly increased. In some cases, it is even faster than in Ext4. Moreover, such a structure allows making snapshots of the file system without performance degradation.

The Btrfs file system is actively developing nowadays and more and more often there is news on the Internet about the possibility to use Btrfs instead of Ext4 in new Linux distributions. It is the reason why this file system is getting more and more attention both among professionals and regular Linux users.

The Btrfs file system features

The B-trees structure allows the developers to introduce many modern features that are missing, for example, in Ext4. Among the most significant ones are the following:

1) The maximum writable file size has increased noticeably. Now it is 16 Exabytes (instead of 1 Exabyte in Ext4);

2) The possibility of creating snapshots without performance loss. Users can now create read or write snapshots;

3) Ability to check the integrity of the file system without unmounting it. In Btrfs, integrity checking is done with a few commands;

4) There is a new background process, the main task of which is to detect and fix errors. The same process automatically defragments and deduplicates data;

5) The number of inodes is allocated dynamically. It means that you will never run into a situation where you have free space on a disk, but you cannot create a file due to a lack of free inodes.

6) Using checksums for both data and metadata. The crc32 algorithm is used to calculate them. This approach allows you to detect block corruptions quickly;

7) Btrfs is fully optimized to install, and work on SSDs. The drive type is detected automatically and the corresponding file system parameters are applied;

8) It is now possible to implement complex multi-disk configurations. That is, now you can create some analog of RAID 0, 1, 5, 6, or 10 using the possibilities of the file system. Levels 5 and 6 are still at the experimental stage. In the future, it is also planned to implement redundancy for individual files and folders.

9) Compression support has been implemented. Zlib and LZO are used for this;

10) Subvolumes supporting;

The developers put a lot of effort into Btrfs. It allowed them to create a fairly efficient file system, which has already been implemented in many Linux distributions, on an experimental level. Thus, there is a high possibility that Btrfs will be used in Linux permanently soon.

Read more:  How to rename a user data folder in Windows 10

The Btrfs file system structure

The Btrfs file system structure is a little different from conventional file systems. Schematically, it looks something like this:

This scheme should be viewed from bottom to top. First, we can see the memory blocks that the file system has allocated in the appropriate order. After that, they are combined into some logical address space. That is, at this level, each block is assigned an address.

Then, metadata and extents are used, which are addressed on the logical level. At this level, redundancy is also implemented (some analog of RAID 0, 1, 5, 6, 10).

The penultimate level is Subvolumes. Encapsulation of the lower layers takes place at this level. It allows displaying the data in the way we are all used to – as files and folders.

The top layer is where the user data is already in its normal form.

More experienced users may have noticed that Btrfs does not use a superblock, or any other familiar file system elements. The reason is that it makes better use of the free disk space of the drive and improves the performance of the file system.

Despite all the advantages of the Btrfs file system, it has a few disadvantages. It will be discussed in the next paragraph of this article.

The main disadvantages of the Btrfs file system

Most of the advantages of the Btrfs file system have already been mentioned in the second paragraph of this article as innovations. So there is no point in recounting them a second time. We would like to focus on the main disadvantages of Btrfs, which are also quite a few:

  1. High level of data fragmentation – occurs due to the use of “copy-on-write” technology. Most often observed when overwriting a large number of small data blocks.
  2. Active development – although the Btrfs file system is quite stable, it regularly adds new features or upgrades old ones due to active development. It can lead to problems and potential data loss. In some cases, after upgrading different features of the file system, the programs that used them may behave incorrectly.
  3. Too little documentation – although the Btrfs filesystem has been released over a decade ago (in fact, it is only a year younger than Ext4), there is not much documentation at the moment. Therefore, users may have questions that are not easy to answer.
  4. To work with snapshots, it is better to use a special utility, since using the standard Linux functionality does not always work correctly, and can lead to data corruption.

Although there are much more advantages than disadvantages, we recommend that you consider carefully before starting to use the Btrfs filesystem. It will avoid many problems in the future.

Btrfs file system recovery features

In the second paragraph of this article, we mentioned working with subvolumes and metadata in passing. Let’s look at these processes in more detail.

First of all, it should be mentioned that the possibility to combine several disks into one logical space (some kind of LVM analog) allows for mirroring both for metadata and for subvolumes. This option is configurable when you create the filesystem.

But the point is next: if the user has configured metadata mirroring – in case of file or filesystem structure corruption, one of the copies will be used as the source for data recovery. But most importantly, since the metadata is much smaller than the user’s data, there is virtually no performance degradation.

While a regular RAID 1 array will write at half the speed of a regular disk, with Btrfs you will experience virtually no performance degradation.

In addition to RAID 1, you can use all the classic RAID types.

To choose a RAID type for your subvolumes – read the article “What are RAID arrays and how to use them?” You’ll find a lot of useful information on this subject there

Read more:  How to recover data from RAID 0 array?

One more important point is the use of checksums for user data and for metadata. When reading a file Btrfs constantly analyzes them and in case of the slightest mismatch, with one of the metadata copies, the system will automatically restore the information.

Thus, the Btrfs file system allows you to effectively detect hidden damage and repair corrupted files.

How to open a Btrfs drive in Windows?

It is not uncommon for Linux users to need to open a flash drive or removable hard disk in a Windows operating system — ranging from simple file copying to more specific tasks. But, in any case, you will see an error when you connect a drive with the Btrfs file system.

The reason is that Windows by default can only recognize three file system types: NTFS, FAT (16, 32), and exFat. It does not understand all the others.

owever, there are several relatively easy ways to open a Btrfs drive in Windows.

The first (and most correct) way is to use the RS Partition Recovery program. All you need is to install the program. Then you can immediately work with the Btrfs drive. Everything is extra simple.

RS Partition Recovery is very easy to use and does not require many computer resources.

But most importantly, RS Partition Recovery allows you to recover lost data. If you accidentally delete an important file or format a drive, you will be able to recover important information without any problems.

In addition, RS Partition Recovery supports ALL modern file systems, so you will be able to open almost any drive in Windows. Regardless of the file system type.

All of the above items make the RS Partition Recovery program a universal tool that should be in the arsenal of every user.

The second way is to install a special driver that will read the Btrfs file system. There are currently two drivers from different manufacturers, WinBtrfs, and Btrfs for Windows.

Both of these drivers work, albeit with low speed. But the main disadvantage of this method is that often these drivers conflict with the Windows device drivers.

Thus, quite often, instead of Btrfs file system support, users end up with a non-functional Windows. In addition, it is not uncommon for a driver conflict to cause the system to malfunction with a Btrfs drive, and corrupt the data.

Sometimes it is really hard to restore Windows functionality, and the last solution is to fully reinstall Windows. Usually, it leads to loss of data on the C:\ drive.

That is why we recommend using the first method as it is more efficient and safer.

The best alternatives to the Btrfs file system?

Although the Btrfs file system provides high performance and has all the modern features, many people are still afraid to use it, arguing that reliability is much more important than performance.

It’s worth mentioning that today Btrfs is quite reliable and has been added to many Linux distributions at the test level. If that does not convince you, then the best alternative to Btrfs for home use is the Ext4.

It is time-tested, and everyone knows what to expect. But you will have to sacrifice a lot of modern features. Including some of the security features that Btrfs has.

If we are talking about a server, then the best alternative is the ZFS file system. In this case, you will have to learn a lot of commands and utilities to use it. Otherwise, you will not be able to use it to its full potential.

So you should consider all the options carefully to choose the one that best fits your needs.

We hope that we were able to make it as easy as possible for you to choose a file system to use.

Frequently Asked Questions

Leave a comment
Online Chat with Recovery Software