If you are a Linux hobbyist you often face a common dilemma, choosing the right filesystem can be tough. There are so many filesystems out there, and sometimes people don’t know what’s the right choice for their needs.
In the post I’d like to make a comparison between the two most common filesystem: Extended Filesystem 4 (aka EXT4) versus BTRFS.

First of all, why file systems exists?

Imagine a librarian for your computer’s storage. The filesystem, which is a built-in software layer, meticulously organizes your files. It keeps track of file names, sizes, creation dates, and even acts as a traffic cop, controlling how data is stored and retrieved from the disk.
In short, filesystems provide a structured and reliable way to store, manage, and access your data on a computer system.

EXT4 - The default filesystem for most Linux distributions

EXT4 is the most common filesystem for most Linux distributions. This widespread adoption is the responsibility of hundreds of millions of devices.
It was released in October 2008 with the release of Linux kernel version 2.6.28 and was an upgrade to the EXT3 file system, the previous standard.
Using EXT4 offers many advantages, including:

  • Reliability - EXT4 includes a number of features that can help to improve the reliability of your data, such as checksumming.
  • Backward compatibility - Since EXT4 is a new version of an older file system (EXT3), it has the ability to support older versions such as EXT1 or EXT2.
  • Journaling - EXT4 utilizes a journaling system to keep track of the location of every file and directory on the disk. This system also monitors any changes made to the files or directories, contributing to consistent write and read speeds. This significant advantage makes EXT4 a popular choice for many users.

BTRFS - Player from other kind

BTRFS, a relatively new filesystem known for its B-tree structure, was developed collaboratively through an open-source project.
This filesystem utilizes the copy-on-write principle. When data changes, the filesystem creates a copy of the modified data and writes it to a new location in the filesystem:

By copying and modifying data to a different location in the filesystem, the risk of data corruption in the event of a power outage is eliminated.
It is important to note that the original data remains unchanged during this process. However, the Btrfs filesystem does have a drawback: large files can fragment easily, requiring periodic defragmentation.

Btrfs development began in 2007 by Oracle, with contributions from companies like SUSE, Facebook, and Redhat. This focus on advanced features reflects the original goal: to extend filesystem functionality with features like snapshots and checksum checks.

BTRFS has several significant advantages that distinguish it from other filesystems:

  1. Handles massive files - Supports files up to a staggering 16 Exabytes!
  2. Highly efficient file storage - Large files stored spread across different blocks on the disk. The filesystem utilizes smaller metadata files, which together enable faster and more efficient disk operation.
  3. Build-in support for RAID0 and RAID1.
  4. Allows defragmentation and resizing of volumes even while the system is running.
  5. Full snapshot support- Easily create backups of the filesystem and use them on a separate disk or in case of accidental deletion or data corruption.
  6. Checksum Support - Utilizes small blocks of data called checksums to prevent file corruption. Checksums are stored in the filesystem and continuously monitor for signs of filesystem errors and data corruption.
  7. Optimized for SSD’s- Delivers enhanced performance and reliability when used with SSD drives.

Comparison

EXT4 BTRFS
Type Journaled CoW
Max. Partition Size 1EiB 16EiB
Max. File Size 16TB 16EiB
Max. File Length Name 255 Char. 255 Char.
Max. File Numbers 4,294,967,296 = ~4 Billion 18 Quintillion! (10 to the power of 18, or 1 followed by 18 zeroes)
Backups No build-in support Full snapshots support
Checking for Files Integrity No Supports CRC32C Checksum
Efficiency less efficient More efficient
Prevention of Duplication No Included
Data Compression No Supports

Conclusion

The Ext4 file system has been the default file system for over a decade and has proven to be reliable and stable. It is suitable for everyday use and efficient enough to protect data in most power loss events. The system has been under testing and bug fixing for years, making it a stable option that is hard not to recommend. However, EXT4 does not support modern features like compression and deduplication.

Btrfs can handle up to 16 times more data than Ext4. While this advantage is not significant for the average user, it can be important for businesses and organizations. Features like CoW, Checksums, and Snapshots make BTRFS a significant upgrade. However, BTRFS is not considered stable enough. Many BTRFS users have reported that the partition breaks after a certain period of time, which created a lot of noise in the Linux community and biased the recommendation towards EXT4. It is important to note that Btrfs is under constant development and its stability is only improving over time.

Final Thoughts

I use EXT4 on my personal computer and Btrfs on my server. It is possible that I will switch my personal computer to Btrfs in the near future because I truly believe it is the file system of the future.