Linux File System (original) (raw)

Last Updated : 13 May, 2026

The Linux File System is a structured method of storing and organizing data on a Linux machine. It arranges files in a hierarchical directory format starting from the root directory /.

Linux File System Structure

The Linux file system architecture is organized into three important layers, each responsible for different functionalities. These layers work together to provide smooth file access, storage, and management.

1. Logical File System

2. Virtual File System (VFS)

3. Physical File System

the_architecture_of_a_file_system

Architecture

Characteristics of a File System

A file system defines the structure, rules, and methods for how data is organized, stored, accessed, and managed on a storage device.

1. Space Management

2. Filename

3. Directory

4. Metadata

5. Utilities

6. Design

**Advanced File System Features

**1. Journaling

Journaling file systems maintain a special log called a journal that records file system changes before they are permanently written to disk. This helps restore data in case of unexpected shutdowns or crashes.

How Journaling Works

**Journaling Modes

Journaling can operate in three different modes, each offering a balance between speed and data safety:

**1. Journal Mode (Highest Safety)

**2. Ordered Mode (Balanced)

**3. Writeback Mode (Fastest)

**2. Versioning

Versioning file systems keep track of previous versions of a file, allowing users to recover older copies when needed.

**Key Points:

**3. Inode

An inode (index node) is a data structure that stores important information about files and directories.

**Inode Contains:

Inodes act as the internal identity of files in Linux file systems.

File System Implementations

Here are some linux file systems:

file

File System Implementations

**Note: _Cluster and distributed file systems will not be included for simplicity.

1. ext (Extended File System)

2. ext2

3. Xiafs

4. ext3

5. JFS (Journaled File System)

6. ReiserFS

7. XFS

8. SquashFS

9. Reiser4

10. ext4

11. btrfs (B-tree / Better FS)

12. bcachefs

13. Others (NTFS, exFAT, etc.)

File Systems Comparison

Given below is a comparative overview of different file systems based on their storage limits, supported features, and structural capabilities.

table_8

File Systems Comparison

1. Maximum Filename Length

Allowable Characters in Directory Entries

Maximum Pathname Length

Maximum File Size

Maximum Volume (Filesystem) Size

Maximum Number of Files

Metadata Journaling

Compression Support

Block Sub-allocation

Online File System Growth

Encryption Support

Checksum Support

ext4 in the Linux File System

The ext4 (Fourth Extended File System) was designed with full backward compatibility to ext3 and ext2. It builds upon their strengths while introducing major enhancements in performance, scalability, reliability, and storage flexibility.

**Example: Suppose our use case is to set up a server that stores and serves large multimedia files (videos, audio files, etc.). In this scenario, we need a file system optimized for high-speed data transfer and efficient handling of large files.

The XFS file system is a suitable choice because it is optimized for large files, supports high throughput, and performs exceptionally well in media-heavy environments.

Steps to Set Up and Use XFS

Step 1: Install XFS Utilities

Install the required tools for managing the XFS file system:

sudo apt install xfsprogs

Installing xfsprogs

Step 2: Create a Partition

Create or choose a partition (e.g., /dev/sda1) where XFS will be applied.
You can use tools like:

to create/manage the partition.

Step 3: Format the Partition as XFS

Format the partition using the XFS file system:

sudo mkfs.xfs /dev/sda1 -f

Format the partition

Step 4: Mount the XFS Partition

Mount the formatted XFS partition to a directory:

sudo mount /dev/sda1 /mnt/jayesh_xfs_partition

mounting of XFS partition

sudo mkdir /mnt/my_xfs_data

Step 5: Verify the Mount

Check whether the XFS partition is mounted successfully:

df -h

Successful mount