Skip to content

Filesystems — Organizing and Managing Data on Linux Storage

A filesystem is the method Linux uses to organize, store, retrieve, and manage data on a storage device. Without a filesystem, a partition is simply raw storage that cannot hold files or directories. Every Linux administrator, DevOps engineer, Cloud Architect, Platform Engineer, and Site Reliability Engineer (SRE) must understand filesystems because they form the foundation of data storage in Linux.


Learning Path

Linux Mastery → Module 9: Storage Management → Lesson 2

Difficulty: Beginner → Intermediate

Reading Time: 80 Minutes

Course Progress

Course: Linux Mastery

Module: Storage Management

Lesson: 2 of 10


What You'll Learn

After completing this lesson, you'll be able to:

  • Understand filesystems
  • Learn common Linux filesystem types
  • Create filesystems
  • Format partitions
  • View filesystem information
  • Work with UUIDs and labels
  • Compare filesystem types
  • Apply filesystem best practices

Prerequisites

Complete:

  • Module 1 – Linux Fundamentals
  • Module 2 – Linux Command Line Essentials
  • Module 3 – Text Processing
  • Module 4 – File Management
  • Module 5 – Users and Groups
  • Module 6 – Process Management
  • Module 7 – Package Management
  • Module 8 – Networking
  • Module 9 Lesson 1 – Partitions

Why Learn Filesystems?

Imagine:

  • Installing Linux on a new server.
  • Formatting a newly created partition.
  • Creating storage for databases.
  • Mounting a new SSD.
  • Recovering from filesystem corruption.

Before storing data, every partition must contain a filesystem.


What is a Filesystem?

A filesystem defines how data is stored and organized on a storage device.

Without a filesystem:

Disk


Raw Storage


Cannot Store Files

With a filesystem:

Disk


Filesystem


Files

Directories

Permissions

Metadata

Filesystem Components

A filesystem manages:

  • Files
  • Directories
  • Metadata
  • Permissions
  • Ownership
  • Timestamps
  • Free space
  • Inodes

Common Linux Filesystems

Linux supports many filesystem types.

Common examples:

  • ext4
  • XFS
  • Btrfs
  • FAT32
  • exFAT
  • NTFS
  • Swap

ext4

The default filesystem for many Linux distributions.

Advantages:

  • Stable
  • Reliable
  • Excellent performance
  • Journaling support
  • Large file support

Commonly used for:

  • Root filesystem
  • Home directories
  • General-purpose servers

XFS

Enterprise filesystem developed for high-performance workloads.

Advantages:

  • Excellent scalability
  • High performance
  • Online filesystem expansion
  • Efficient handling of large files

Commonly used for:

  • Database servers
  • Enterprise storage
  • Red Hat Enterprise Linux

Btrfs

Modern Linux filesystem.

Features:

  • Snapshots
  • Compression
  • Checksums
  • RAID support
  • Subvolumes

Commonly used for:

  • Advanced storage
  • Snapshot management
  • Development environments

FAT32

Supported by almost every operating system.

Limitations:

  • Maximum file size: 4 GB
  • No Linux permissions
  • No journaling

Commonly used for:

  • USB drives
  • Memory cards

exFAT

Designed for flash storage.

Advantages:

  • Supports large files
  • Cross-platform compatibility
  • Better than FAT32 for modern USB devices

NTFS

Microsoft Windows filesystem.

Linux can read and write NTFS using appropriate drivers.

Commonly used for:

  • Dual-boot systems
  • External drives

Journaling Filesystems

A journal records pending filesystem changes before they are written.

Advantages:

  • Faster recovery after crashes
  • Reduced filesystem corruption
  • Better reliability

Examples:

  • ext4
  • XFS
  • Btrfs

View Filesystems

Display mounted filesystems.

df -Th

Example:

Filesystem

Type

Size

Mounted on

View Block Devices

lsblk -f

Shows:

  • Filesystem type
  • UUID
  • Label
  • Mount point

View Filesystem UUIDs

blkid

Example:

UUID="..."

TYPE="ext4"

Create an ext4 Filesystem

sudo mkfs.ext4 /dev/sdb1

Create an XFS Filesystem

sudo mkfs.xfs /dev/sdb1

Create a FAT32 Filesystem

sudo mkfs.vfat /dev/sdb1

Assign a Filesystem Label

For ext4:

sudo e2label /dev/sdb1 DATA

View the label.

lsblk -f

View Filesystem Information

For ext4:

sudo tune2fs -l /dev/sdb1

Displays:

  • UUID
  • Block size
  • Reserved blocks
  • Mount count
  • Filesystem features

Check Filesystem Type

lsblk -f

or

blkid

Common Commands

Display filesystems.

df -Th

View block devices.

lsblk -f

View UUIDs.

blkid

Create ext4.

mkfs.ext4 /dev/sdb1

Create XFS.

mkfs.xfs /dev/sdb1

Real Production Examples

Format a new cloud volume.

sudo mkfs.ext4 /dev/nvme1n1p1

View mounted filesystems.

df -Th

Display filesystem UUID.

blkid

Check filesystem details.

sudo tune2fs -l /dev/sdb1

Production Perspective

Filesystems are used for:

  • Operating system partitions
  • Databases
  • Application storage
  • Backup volumes
  • Kubernetes persistent volumes
  • Cloud block storage
  • NAS devices
  • SAN storage

Choosing the correct filesystem is critical for performance and reliability.


Hands-on Lab

Task 1

View mounted filesystems.

df -Th

Task 2

Display filesystem information.

lsblk -f

Task 3

Display UUIDs.

blkid

Task 4

Create an ext4 filesystem on a test partition.

sudo mkfs.ext4 /dev/sdb1

Use only a non-production partition for this exercise.


Task 5

Assign a label.

sudo e2label /dev/sdb1 DATA

Task 6

Verify the label.

lsblk -f

Task 7

Display filesystem details.

sudo tune2fs -l /dev/sdb1

Task 8

Compare filesystem types.

df -Th

Observe the different filesystem types mounted on your system.


Command Deep Dive

Command Purpose Production Example
df -Th Display mounted filesystems Capacity planning
lsblk -f View filesystem information Storage inventory
blkid Display UUIDs Persistent mounts
mkfs.ext4 Create ext4 filesystem Linux server storage
mkfs.xfs Create XFS filesystem Enterprise storage
tune2fs View ext4 information Filesystem management

ext4 vs XFS vs Btrfs

Feature ext4 XFS Btrfs
Stability Excellent Excellent Good
Journaling Yes Yes Yes
Snapshots No No Yes
Compression No No Yes
Online Expansion Yes Yes Yes
Enterprise Adoption High Very High Growing

Production Troubleshooting Scenario

Scenario

A new storage volume has been attached to a Linux server.

The administrator creates a partition but cannot mount it.

Investigation:

Check the filesystem.

lsblk -f

Output:

FSTYPE

(blank)

The partition has no filesystem.

Create an ext4 filesystem.

sudo mkfs.ext4 /dev/sdb1

Verify.

blkid

The partition now has a valid filesystem and can be mounted successfully.


Best Practices

  • Use ext4 for general-purpose Linux servers.
  • Use XFS for enterprise workloads requiring high scalability.
  • Use Btrfs when snapshot and advanced storage features are required.
  • Always verify the target partition before formatting.
  • Use filesystem labels and UUIDs for easier administration.
  • Back up important data before creating or reformatting filesystems.

Common Mistakes

❌ Formatting the wrong partition.

✅ Avoid this mistake: formatting the wrong partition.


❌ Forgetting that formatting erases existing data.

✅ Remember to that formatting erases existing data.


❌ Choosing an inappropriate filesystem for the workload.

✅ Choose carefully: avoid an inappropriate filesystem for the workload when inappropriate.


❌ Ignoring filesystem labels and UUIDs.

✅ Always review filesystem labels and UUIDs.


❌ Attempting to mount an unformatted partition.

✅ Avoid this mistake: attempting to mount an unformatted partition.


Interview Questions

Beginner

  1. What is a filesystem?
  2. Why is a filesystem required?
  3. What is the default filesystem used by many Linux distributions?
  4. Which command creates an ext4 filesystem?

Intermediate

  1. What is journaling?
  2. What is the difference between ext4 and XFS?
  3. How do you display filesystem UUIDs?
  4. Why are UUIDs preferred over device names?

Architect Level

  1. Which filesystem would you choose for a production database server and why?
  2. How would you design storage for large enterprise applications?
  3. What factors influence filesystem selection in cloud environments?

Summary

In this lesson, you learned:

  • Filesystem fundamentals
  • Common Linux filesystem types
  • Journaling
  • Creating filesystems
  • Viewing filesystem information
  • Filesystem labels and UUIDs
  • Production storage best practices

A filesystem is the bridge between raw storage and usable data. Selecting the appropriate filesystem and understanding how to create and manage it are essential skills for building reliable Linux storage infrastructure.


Key Takeaways

  • A filesystem organizes data on a storage device.
  • ext4 is the default choice for many Linux systems.
  • XFS is widely used for enterprise workloads.
  • Btrfs provides advanced features such as snapshots.
  • mkfs creates filesystems.
  • lsblk, df, and blkid are essential filesystem management tools.

What's Next?

mkfs — Creating Filesystems in Linux

You'll explore:

  • The mkfs command
  • Creating different filesystem types
  • Formatting storage devices safely
  • Assigning filesystem labels
  • Verifying newly created filesystems
  • Common mkfs options
  • Production formatting best practices

Creating a filesystem with mkfs is the next step after partitioning and before mounting storage.