A File System is the underlying data structure and indexing mechanism by which an operating system controls how data is saved, identified, isolated, and retrieved from physical storage media (such as NVMe SSDs, SATA hard drives, USB flash drives, or network shares). Without a filesystem, data stored on a storage medium would be an unorganized, monolithic stream of billions of raw binary zeroes and ones with no way to tell where one file ends and the next begins.
Unlike Windows—which assigns individual drive letters (such as C:, D:, and E:) to partitions—Linux treats all storage devices as part of a single, unified, inverted tree structure originating from the single root directory represented by a forward slash (/).
One of the fundamental design philosophies inherited from Unix is that virtually all resources in the operating system are represented as files. This architectural elegance allows software applications to communicate with hard drives, memory, terminal screens, and network sockets using identical, standardized system calls (open(), read(), write(), and close()).
| Indicator | File Type | Description & System Role | Example |
|---|---|---|---|
- |
Regular / Ordinary File | Contains text, source code, multimedia, or binary compiled executables. | /etc/hosts, script.sh |
d |
Directory | A special file containing a list of filename-to-inode index mappings. | /home/student, /var/log |
l |
Symbolic Link | A pointer or shortcut containing the pathname to another file or folder. | /bin -> usr/bin |
b |
Block Device | Hardware storage transferring data in fixed buffered chunks/blocks (e.g., hard drives, flash disks). | /dev/sda, /dev/nvme0n1 |
c |
Character Device | Hardware providing unbuffered, serial stream data byte-by-byte (e.g., terminals, pseudo-random generators). | /dev/tty1, /dev/urandom |
p |
Named Pipe (FIFO) | First-In-First-Out communication channel allowing two independent processes to exchange data. | Created via mkfifo mypipe |
s |
Unix Domain Socket | High-performance bi-directional inter-process communication endpoint on the local host. | /run/systemd/private |
When a disk partition is formatted with a filesystem (such as ext4), the operating system creates several structural regions across the storage sectors:
| Filesystem Region | Technical Purpose & Stored Information |
|---|---|
| Boot Block | Occupies the first few sectors of the disk; contains the bootstrap code executed by GRUB or UEFI firmware to load the Linux kernel. |
| Superblock | Stores global metadata describing the entire filesystem: total block count, total inode count, block size (typically 4 KB), volume label, mount counts, and free space allocations. Multiple backup copies are distributed across block groups to enable repair if the primary superblock is corrupted. |
| Inode Table | An indexed array of Inodes (Index Nodes). Every file and directory on the disk has exactly one assigned inode number. |
| Data Blocks | The physical storage sectors where the actual binary payload bytes of files or directory lists are stored. |
An Inode (short for Index Node) is a 256-byte data structure containing all metadata about a file:
"notes.txt" → Inode 142857).
Linux provides two distinct methods to reference files through multiple paths:
| Property | Hard Link (ln target link) |
Soft / Symbolic Link (ln -s target link) |
|---|---|---|
| Inode Identity | Shares the exact same Inode number as the original file. | Possesses its own unique, new Inode number. |
| Cross-Filesystem | Cannot cross partitions (Inodes are only unique within a single filesystem). | Can span different partitions, external drives, or network mounts. |
| Directory Linking | Cannot link directories (prevents infinite recursive loops). | Fully supports linking directories. |
| Deletion of Target | File data remains completely accessible; data is only wiped when the link count reaches 0. | Becomes a dangling (broken) link pointing to a nonexistent destination. |
| Filesystem | Primary Strengths & Target Environment | Max File Size | Max Volume Size |
|---|---|---|---|
| ext4 (Fourth Extended) | The rock-solid standard for general-purpose computing. Backward compatible, uses extents for continuous block allocation, highly resilient against fragmentation. Default in Ubuntu and Debian. | 16 TB | 1 EB (Exabyte) |
| XFS | High-performance 64-bit journaling filesystem created by Silicon Graphics (SGI). Optimized for large files, parallel multi-threaded I/O, and enterprise database servers. Default in RHEL, Rocky, and AlmaLinux. | 8 EB | 8 EB |
| Btrfs (B-tree FS) | Advanced Copy-on-Write (CoW) filesystem featuring integrated subvolumes, writable instant snapshots, online defragmentation, and built-in software RAID. Default in Fedora and openSUSE. | 16 EB | 16 EB |
| ZFS (OpenZFS) | Enterprise combined storage pool and filesystem with 128-bit capacity, end-to-end data checksumming to eradicate silent data corruption (bit rot), and native drive pooling. | 16 EB | 256 Quadrillion ZB |
| VFAT / exFAT / NTFS | Cross-platform filesystems used for USB flash drives, SD cards, and dual-boot Windows partitions via the Linux FUSE kernel module (ntfs-3g). |
4 GB (FAT32) / 16 EB (exFAT) | 2 TB (FAT32) / 128 PB |
Let us practice executing essential filesystem inspection and linking commands in the terminal:
ls -li and stat# View files along with their unique inode numbers (first column):
ls -li /etc/passwd
# Output: 142857 -rw-r--r-- 1 root root 2842 Nov 02 08:30 /etc/passwd
# View detailed metadata structure using stat:
stat /etc/passwd
# Displays exact Inode, Device ID, Links, Access/Modify/Change timestamps, and block sizes.
# 1. Create a dummy test file:
echo "Mastering Linux File Systems" > original.txt
# 2. Create a Hard Link:
ln original.txt hardlink.txt
# 3. Create a Soft (Symbolic) Link:
ln -s original.txt softlink.txt
# 4. Inspect inodes and link counts:
ls -li original.txt hardlink.txt softlink.txt
# Notice: original.txt and hardlink.txt share the IDENTICAL inode number and have link count = 2!
# softlink.txt has a DIFFERENT inode number and points to original.txt.
# 5. Delete the original file:
rm original.txt
# 6. Test both links:
cat hardlink.txt # Still displays "Mastering Linux File Systems"!
cat softlink.txt # Errors out: "No such file or directory" (Broken link)
# View mounted filesystems, total storage, and filesystem type:
df -Th
# Check for Inode Exhaustion (crucial troubleshooting command):
df -i
# If an inode column shows 100%, the disk CANNOT create new files even if gigabytes of free disk space remain!
/dev/sda), input streams, network communication sockets, and kernel process metrics (/proc)—are exposed to programs through a unified filesystem interface and manipulated using standard system calls like open(), read(), write(), and close().
fsck scanning.
You now possess a thorough technical foundation of Linux file structures, inodes, data blocks, and filesystem types. In the next tutorial, we explore the standardized layout of Linux directories in Class 23: The Filesystem Hierarchy Standard (FHS 3.0).