The most common Linux file systems
If you examine a hard drive closely, you will notice that its storage space is made up of a series of bytes. If you examine the hard drive closely, you will notice that it usually includes an operating system. Segmenting this storage space, also known as partitioning, is the first step to using it, followed by creating a file system.
As opposed to formatting space, Linux filesystems are often referred to as "created file systems." A file system organizes raw storage space, such as a disk partition, to store data.
When describing storage space, whether it consists of one or more file systems, we will refer to a file system as a single file system attached to a single storage device using the term "file system.".
It is important to note that there are several types of filesystems, with the most common in the Linux environment being ext and xfs.
Extended File System (Ext)
In Linux and other Unix-like operating systems, the Extended File System (Ext) is a family of file systems. These file systems are used to organize and manage data stored on storage devices such as hard drives and solid-state drives in Linux systems. There are several versions of these file systems, including Ext2, Ext3, and Ext4.
Ext2 :
One of the first file systems used in Linux is Ext2. In case of power outages or crashes, it is vulnerable to data corruption, since it does not maintain a journal to track changes. The maximum file size is 2 terabytes, while the maximum volume size is 32 terabytes.
In spite of its lack of advanced features, Ext2 is simple and reliable. Although it may not be the best choice for systems with a high level of data integrity, it is suitable for most use cases.
Ext3 :
In addition to Ext2, Ext3 supports journaling and improves data integrity and file system recovery in the event of system crashes or shutdowns. The file and volume size limitations are the same as those for Ext2.
Since Ext3 is more reliable than Ext2, it is a popular choice for many Linux distributions.
Ext4 :
Aside from offering larger file systems, better performance, and more scalability, Ext4 also supports larger volumes. Data files can now reach 16 terabytes, and the volume sizes can reach an exabyte.
Many Linux distributions use Ext4 as their default file system since it includes features like delayed allocation, extents, and enhanced support for extended attributes.
Today, Ext4 is the most commonly used Ext file system version, and it is well suited for a wide range of applications. Because of their advanced features and capabilities, other file systems, like XFS or ZFS, might be more suitable for specific workloads, such as high-performance file storage or large-scale data storage.
X File System (XFS)
An advanced file system that is used in Unix-like operating systems, including Linux, XFS stands for X File System, a high-performance file system. SGI (Silicon Graphics, Inc.) initially developed XFS, which has been a part of the Linux kernel since 2001. It is renowned for its scalability, reliability, and wide range of features. Here are some key characteristics of XFS :
- An exabyte is a theoretical maximum size for a file or a complete filesystem. It is the theoretical maximum size for both. During practice, Red Hat's limit for ext-type filesystems is determined by distribution-specific parameters (100 Terabytes for Red Hat 6, 500 Terabytes for Red Hat 7), but it permits us to surpass the current limit of 16 Terabytes for ext-type filesystems.
- To ensure filesystem consistency in the event of hardware failure, write operations on metadata are recorded in a journal prior to being executed.
- As a result of the organization into allocation groups (internally, the filesystem is split into several independent subsets), multiple I/O operations are possible on the same filesystem at the same time, making it an excellent choice for multithreaded applications.
- There are several techniques used to ensure high levels of performance and scalability, including indexed trees (B-trees) for metadata, delayed allocation, preallocation to prevent fragmentation, online defragmentation, extent-based allocation, among others.
- Tools for verifying and correcting file systems are very fast.
- In addition to the traditional Unix/Linux access rights, extended attributes allow users to manage access control lists (ACLs) as well as attributes specific to specific applications.
- A flexible system for setting space usage quotas, by group, by user, or by "project" (quota associated with a branch of the directory tree).
- It is possible to perform online backups using compatible snapshots, a technique that takes a snapshot of the file system's state at a given time.
- The ability to expand a filesystem in the course of its use (but not reduce its size) is known as online extensibility.
- Tools for backing up and restoring the file system.
Generally, this type of file management system is designed for large servers, and it requires a considerable amount of RAM as well as a reliable and secure hardware component (a cache backed up by a battery).
ReiserFS file system
This Linux file system, developed by Hans Reiser, has been less common and popular than Ext4 and XFS. ReiserFS has some unique features and characteristics.
- The ReiserFS file system uses a balanced tree structure for its file organization, which can provide good performance under certain workloads.
- The ReiserFS file system supports journaling, which maintains file system integrity during power outages or crashes.
- Due to its tree structure, ReiserFS is particularly efficient at handling small files.
ReiserFS, however, has several factors to consider:
- Its popularity has declined since its creation by Hans Reiser, partly due to his legal troubles. This has resulted in fewer people using the system or developing it.
- Despite ReiserFS' ability to offer good performance for some workloads, it may not perform as well as Ext4 or XFS in many cases, especially on modern hardware.
- In terms of compatibility, ReiserFS is not as widely accepted or supported as Ext4 and XFS.
BTRFS file system
The BTRFS file system, also referred to as the Butter File System or the B-tree File System, is an advanced and modern Linux file system. A wide range of features are provided by Btrfs, which was developed by Oracle to address the limitations of older file systems such as Ext4 and address those limitations. Some of the key characteristics and features of Btrfs include data integrity, scalability, and flexibility.
- As part of its copy-on-write mechanism, Btrfs writes data to a new location on the disk every time it is modified or written, preserving the original data until the new write is confirmed. This ensures the integrity of the data.
- As a result of implementing COW on both data and metadata, Btrfs significantly reduces the possibility of data corruption due to unexpected system crashes or power outages.
- In addition, Btrfs supports snapshots, which are copies of the file system at a particular point in time that can be used for backups as well as versioning.
- By eliminating duplicate data, Btrfs supports data deduplication, which reduces storage space requirements.
- In addition to supporting various RAID configurations, Btrfs is suitable for redundancy and data protection solutions.
- It is possible to check and repair your file system online using Btrfs, resulting in a reduction of downtime and improved maintenance capabilities.
- A Btrfs file system introduces the concept of subvolumes, which are similar to directories. A subvolume may be a snapshot or an independent root of the file system.
- Transparent compression is supported by Btrfs, which contributes to a reduction in storage space requirements.
- It is possible to add and remove storage devices online with BTRFS, which is very useful for dynamically expanding or contracting storage pools.
There is no doubt that Btrfs is a versatile choice for a wide variety of applications, including file storage, backups, and large-scale data storage. As a root file system in many Linux distributions, it provides a compelling alternative to traditional file systems such as Ext4 and XFS due to its ongoing development and feature set. When deciding to use Btrfs as a file system choice, it is crucial to carefully assess your specific needs and compatibility with your Linux distribution.