BTRFS vs. EXT4 – Learn all About BTRFS and EXT4 File Systems

For any computer, a file system is an integral part that defines the way in which the files are named and logically placed. Without a file system, a computer will not be able to systematically store & access files and use them when required.

Like Windows computers, Linux-based computers, servers, and special storage devices, such as NAS and RAID also use different file systems to manage the files. The most commonly used Linux file systems are BTRFS and EXT.

The ext or Extended File System is the default file system of Linux computers. BTRFS is a modern file system developed to overcome the shortcomings of the Ext4. BTRFS is majorly used as a Synology file system for Synology NAS RAID. It is however, also used with other branded/unbranded NAS/RAID systems.

Let’s read further to know more about these file systems and discover the best file system for a NAS and a Linux computer.

What is Ext4 File System?

The ext4, or Fourth Extended File System, is a successor to ext3 released in 2006. Ext is the default & primary file system of a Linux computer. Like its predecessors, the ext4 is a journaling file system that was initially launched as an extension to ext3 for backward compatibility. However, due to stability issues, it was later forked out and developed as a new file system with improved performance, stability, and reliability.

Instead of data blocks, ext4 uses ‘extents’ to improve the performance and reduce metadata overhead for large files. This makes it easier for the file system to define a single iNode pointer entry for longer, adjacent files.

Along with this, ext4 uses an improved file management algorithm that evenly spreads the data across the disk to reduce clustering. This helps in preventing unnecessary data fragmentation between cylinder groups.

Along with these, ext4 allows the file system to be of up to 1 exbibyte (EiB) from a mere 16 TB in ext3. It has also enhanced the maximum file size from a meager 2 TB to a whopping 16 tebibytes.

To evade journal corruption and possible data loss due to corruption, ext4 comes packed with journal checksum to check the health of journal blocks.

Features of the ext4 File System

Illustrated below are some features of ext4 –

Ext4 file system

Large file system – Ext4 supports a file system with a size of up to 1 EiB (exbibyte).

Extents – It is a file's starting and ending place on the hard drive. Ext4 uses it to describe the location of long and physically contiguous files in a single iNode pointer. The usage of a single pointer for files makes this file system efficient.

Multi-block allocation – This feature allows the file system to allocate multiple blocks to a file in a single operation instead of assigning them one by one. This optimizes memory usage and reduces the overhead of calling the ‘block allocator’.

Online defragmentation & faster fsck – Using extents allows ext4 to reduce fragmentation of the data, thereby lowering the chances of data corruption. Also, improved fsck (file system check) speed allows faster correction of any inconsistencies in the file system.

Journal checksumming – Journal checksumming allows ext4 to regularly monitor the health of the journals and avoid data corruption in any scenario.

Backward compatibility – Backward compatibility allows users to easily migrate ext3 file systems to ext4 without formatting or reinstalling the OS. This helps reduce the chances of data loss.

Delayed space allocation – Ext4 improves efficiency by delaying data writes by writing the data in the file system cache before writing it on the disk. This makes sure that the data written to the disk is contiguous.

Extended attributes – Support for extended attributes allows ext4 to associate name and value pairs with files. These attributes are security, system, trusted, and user.

What is BTRFS File System?

Known by many names like B.T.R.F.S., B-Tree FS, BTRFS, or Better FS – this file system is a modern Copy on Write (CoW) file system designed for Linux. It is an advanced file system designed to be resilient against data loss. It focuses on fault tolerance, repair, and easy administration.

When compared side-by-side, the performance of BTRFS vs. Ext4 is one of the primary aspects while looking for a good Linux file system. The latter is mainly used as a file system for Linux-based personal computers. In contrast, the former is used with high-performance data storage devices, large storage servers, and petabyte-scale data clusters. Hence, BTRFS is used on Synology NAS.

B.T.R.F.S. is a logging-style file system where the changes to the original block are not made. Instead of journaling the changes done to the original block, it writes the changes to a new block and links them to the original block. These changes are not committed or finalized until the last write. By doing so, BTRFS eliminates the chances of corruption or data loss due to power failure, etc.

This BTRFS file system was mainly designed to address the lack of pooling, snapshots, checksums, and multiple device spanning in previous Linux file systems. BTRFS supports online defragmentation of data and files, which minimizes the chances of data loss. What this means is that there is no need to unmount the file system before defragmentation.

Features of BTRFS

btrfs file system

Extent-based storage – Similar to ext4, BTRFS has an extent-based file storage that allows files to be stored adjacent to one another. This helps lower the chances of fragmentation, improve the storage efficiency and performance of a file system.

Huge file size support – BTRFS supports a maximum file size of 2^64 bytes or 16 EiB. This makes it extremely compatible with large files.

Efficient file packing – Since BTRFS supports extent-based storage, irrespective of how small a file is, BTRFS embeds them in the metadata. Unlike Ext4, where smaller files (< 4KiB) are also stored in 1 extent, files  (< 4 KiB) are stored in metadata. This helps in saving disk capacity.

Space efficient indexing – BTRFS uses two-level indexing to improve file lookup performance and reduce storage requirements for indexes. These two levels are key-based indexing and iNode-based indexing.

Dynamic iNode allocation – Ext4 allows a limited number of iNodes to be created. Btrfs addresses this by allocating iNodes dynamically based on the requirement.

Incremental backup support – BTRFS takes a snapshot of the current file system when you back up to a BTRFS-enabled storage device. It uses this snapshot to compare with subsequent backups to store the changes on the disk. This allows BTRFS to store subsequent backups efficiently in less space.

Unlimited number of subvolumes with quotas – BTRFS supports a virtually unlimited amount of subvolumes. And, each subvolume can have allocated quotas for subvolumes.

Offline file system check – BTRFS has built-in tools that allow users to perform file system checks and repair any errors. These tools also allow users to fix broken BTRFS (that can’t be mounted) easily.

Situations in Which You Can Lose Data from BTRFS or EXT4

No matter the technique/s used for avoiding data loss, data storage devices are always prone to it. Below are some situations in which you can lose your data from a BTRFS or ext4-based storage device –

  • Dirty/corrupt file system
  • Metadata corruption
  • Unsuccessful RAID rebuilds
  • Multiple drive failure
  • Power loss while storing data
  • Data integrity calls not working due to bugs
  • Disabled journaled mode
  • Writeback mode enabled

We understand the importance of data present on your Linux computer and NAS. In a situation where you happen to lose your data from a Linux PC or a NAS, you can use a specialized data recovery software for recovering data from ext4 and btrfs formatted storage drives.

Windows Data Recovery Toolkit is an advanced data recovery software that can help you retrieve your data from Linux-based computer drives and virtual machines. Thanks to its specially designed algorithm for dealing with Linux file systems, recovering files from BTRFS or ext4 devices becomes simple.

BTRFS vs. EXT4: A Comparison

Below are some differences that set BTRFS and EXT4 file systems apart.

 

BTRFS

EXT4

It is a logging file system.

It is a Journaled file system.

The maximum supported file size is 16 EiB.

The maximum supported file size is 16 TB.

A maximum of 264 files can be stored.

A maximum of 232 files can be stored.

CoW-based file system

Default file system of Linux

Built-in Logical Volume Manager allows multiple device support like RAID

Requires external LVM or Logical Volume Manager to support devices like RAID

Supports file-system level deduplication

Doesn’t support file system deduplication

Mainly used for high-performance data storage devices and applications

Primarily used with Linux-based personal computers

Choose the Right File System for your Linux PC

BTRFS vs. EXT4 is a long-standing debate that is going on among many Linux users. These two are the prominent Linux file systems that are used with various devices, ranging from personal computers to advanced data storage solutions, such as RAID and NAS. It can be a little confusing for many Linux users to make a choice between the two. But, with the distinctions clearly drawn above, you can easily make the choice that suits you the most.

However, if you want the best file system for your NAS or Linux PC, solely based upon performance and data integrity, BTRFS would be a great choice for your NAS and Ext4 for your PC.

Related Reads

How to recover data from BTRFS formatted drives?

How to recover data from various Linux partitions on Windows?



Was this article helpful?
FAQs
Copy-on-Write or CoW makes sure that the memory is not wasted by creating a copy of the data, modifying it, and then saving the modified data to a new location until the changes are final.
BTRFS is unnecessary for an SSD as SSDs often add their own write multipliers. Along with this, the techniques might have adverse effects on the SSD lifespan. Only users who use their SSDs extensively beyond 50% to 100% of the number of lifetime writes should consider BTRFS. Hence, compared to NTFS, BTRFS is not a standard choice for an SSD.
While comparing Ext4 vs NTFS, Ext4 is a good file system as compared to NTFS. This is because Ext4 produces less data fragmentation. This helps avoid data loss.
No, this is not feasible as switching between file systems requires reformatting the storage drives and a fresh installation of the operating system.
About The Author
no author img
Keshav Katyal

A passionate writer, driven by his interest in everything tech, Keshav Katyal has always been captivated by the latest gadgets since childhood. His interest in gadgets grew when he got his first gaming console, the Nintendo Game Boy Advanced. Hours and days of tinkering with gadgets encouraged the inner geek in him who now loves writing about the latest technologies.

Table of Contents

WHY STELLAR® IS GLOBAL LEADER

Why Choose Stellar?
  • 0M+

    Customers

  • 0+

    Years of Excellence

  • 0+

    R&D Engineers

  • 0+

    Countries

  • 0+

    PARTNERS

  • 0+

    Awards Received