dotlinux blog

Linux File System Explained: Boot Loading, Disk Partitioning, BIOS, UEFI and File System Types

Have you ever wondered what happens between the moment you press the power button on your computer and when you see the familiar Linux login screen? This process, often taken for granted, is a sophisticated dance of hardware and software involving critical components like the BIOS/UEFI, bootloader, disk partitions, and the file system itself. Understanding this journey is not just for system administrators; it's fundamental knowledge for any Linux user who wants to truly master their system, troubleshoot boot issues, or make informed decisions about disk management.

This comprehensive guide will demystify these core concepts. We'll start from the very beginning with the firmware that initializes your hardware, move through the process of loading the operating system, explore how your disk is organized, and finally, delve into the different types of file systems that Linux can use to store your data efficiently.

2026-05

Table of Contents#

  1. The Foundation: BIOS vs. UEFI
  2. Organizing Your Disk: Partitioning
  3. The Bridge: Bootloaders
  4. Where Data Lives: Linux File Systems
  5. The Linux Directory Structure (/bin, /etc, /var, etc.)
  6. Conclusion
  7. References

The Foundation: BIOS vs. UEFI#

Before the operating system can even be considered, the computer's hardware needs to be awakened and checked. This is the job of the firmware, which comes in two primary forms.

Legacy BIOS (Basic Input/Output System)#

BIOS is the traditional firmware interface that has been used for decades.

  • Function: It performs the Power-On Self-Test (POST) to ensure critical hardware (CPU, memory, storage) is functional.
  • Boot Process: The BIOS looks for a bootable device based on a user-defined order (boot sequence). It then loads the first 512 bytes of data from the disk's Master Boot Record (MBR) into memory. This tiny piece of code contains the primary bootloader.
  • Limitations:
    • MBR Limit: MBR only supports disks up to 2TB.
    • Primary Partitions: MBR allows only 4 primary partitions (or 3 primary + 1 extended containing logical drives).
    • 16-bit Code: Runs in a primitive 16-bit processor mode, leading to slower initialization.

UEFI (Unified Extensible Firmware Interface)#

UEFI is the modern replacement for BIOS, designed to overcome its limitations.

  • Function: Like BIOS, it initializes hardware, but it's more powerful and flexible. It's essentially a lightweight operating system that runs before your main OS.
  • Boot Process: Instead of reading a fixed sector like the MBR, UEFI looks for a special EFI System Partition (ESP), typically formatted as FAT32. This partition contains bootloader files (e.g., grubx64.efi) in a predefined directory structure (/EFI/ubuntu/, /EFI/BOOT/).
  • Advantages:
    • GPT Support: Uses the GUID Partition Table (GPT), which supports disks larger than 2TB and virtually unlimited partitions.
    • Faster Boot: Faster hardware initialization and a more direct boot process.
    • Secure Boot: A security feature that ensures only trusted, signed software (like the OS bootloader) is loaded during boot, preventing malware from hijacking the process.
    • Network Capabilities: Has built-in drivers for networking, allowing for remote troubleshooting.

Key Differences at a Glance#

FeatureBIOSUEFI
InterfaceText-based, simple menuGraphical, can support mouse
Partition SchemeMBR (Master Boot Record)GPT (GUID Partition Table)
Disk Size Limit2TB~9.4 Zettabytes (ZB)
Max Partitions4 Primary (or 3P+1E)128 partitions by standard
Boot ProcessMBR -> BootloaderESP -> EFI Application
Secure BootNot supportedSupported

Organizing Your Disk: Partitioning#

A physical disk drive is like a large, empty plot of land. Partitioning is the process of dividing this land into smaller, manageable plots, each of which can be used for a different purpose.

What is a Partition?#

A partition is a logically independent section of a storage device. Each partition can be formatted with a different file system and used as if it were a separate disk. This allows you to:

  • Dual-boot: Run multiple operating systems (e.g., Linux and Windows) on the same machine.
  • Isolate Data: Separate system files (/) from user data (/home). If the system needs to be reinstalled, your personal files remain safe.
  • Optimize Performance: Use different file systems for different tasks.

Partition Tables: MBR vs. GPT#

The partition table is the "map" that the system uses to understand how the disk is divided. It's stored on the disk itself.

  • MBR (Master Boot Record): The old standard, tied to BIOS systems. As mentioned, it has limitations on disk size and number of partitions. The bootloader code is also stored within the MBR.
  • GPT (GUID Partition Table): The modern standard, used with UEFI. It's more robust, stores redundant copies of the partition table across the disk for better recovery, and supports many more partitions.

Common Linux Partitions#

While you can install Linux on a single partition, a typical setup includes several:

  • / (root): This is the top of the directory tree. It contains all other directories and files. A minimum of 20-25GB is recommended for a basic system, but much more is needed if you install many programs.
  • /boot: Contains the Linux kernel, initial RAM disk (initrd), and bootloader files (like GRUB). For UEFI systems, the EFI System Partition (ESP) serves a similar purpose. It's usually small (500MB-1GB).
  • /home: This is where all user-specific data, documents, pictures, and configurations are stored. It's highly recommended to have a separate /home partition so your personal data persists across system reinstalls.
  • swap: Not a file system per se, but a dedicated area used as virtual memory. When your RAM is full, the kernel moves inactive pages of memory to the swap space. The size of the swap partition is a topic of debate; a common rule of thumb is equal to your RAM size, but with modern systems having large amounts of RAM, it can often be smaller (e.g., 2-4GB) or even a swap file can be used instead.

The Bridge: Bootloaders#

The bootloader is the software that bridges the gap between the system firmware (BIOS/UEFI) and the Linux kernel.

The Role of a Bootloader#

  1. It's loaded by the firmware (from the MBR or ESP).
  2. It presents a menu (if multiple OSes are present) allowing the user to choose which kernel or OS to boot.
  3. It loads the chosen Linux kernel and initial RAM disk (initrd) into memory.
  4. It hands over control to the kernel, and its job is done.

GRUB 2 (Grand Unified Bootloader)#

GRUB 2 is the most common bootloader in the Linux world today. It's highly configurable and supports complex boot scenarios, including chain-loading other bootloaders (e.g., for Windows). Its configuration file is typically located at /boot/grub/grub.cfg (which is auto-generated; user edits are made to /etc/default/grub and files in /etc/grub.d/).

The Boot Process Step-by-Step#

Let's tie it all together with a UEFI/GPT example:

  1. Power On: You press the power button.
  2. UEFI Initialization: The UEFI firmware initializes the hardware.
  3. Secure Boot (Optional): UEFI checks the digital signature of the bootloader.
  4. Find Bootloader: UEFI looks for the EFI System Partition (ESP) and loads the GRUB EFI application (grubx64.efi).
  5. GRUB Takes Over: GRUB reads its configuration from the ESP or /boot/ partition.
  6. GRUB Menu: GRUB displays a menu (if configured) of available kernels.
  7. Kernel Load: GRUB loads the selected Linux kernel and initrd image into memory.
  8. Kernel Execution: GRUB hands control to the kernel. The kernel decompresses itself, initializes hardware using initrd, and then mounts the real root (/) file system.
  9. Init Process: The kernel starts the first user-space process, which is now typically systemd (PID 1).
  10. System Initialization: systemd mounts all other file systems, starts services, and presents the login screen.

Where Data Lives: Linux File Systems#

Once the kernel is running and the partitions are mounted, we need a way to store and retrieve files. That's the file system's job.

What is a File System?#

A file system is a method and data structure that an operating system uses to control how data is stored and retrieved on a storage device. It manages:

  • File Naming: What characters can be used, case sensitivity.
  • Directory Structure: How files are organized in folders.
  • Metadata: Storing information about files (permissions, owner, creation time, etc.).
  • Data Storage: Efficiently allocating space on the disk for file contents.

The Linux Virtual File System (VFS)#

One of Linux's strengths is its ability to support many different file system types simultaneously. This is achieved through the Virtual File System (VFS). The VFS provides a common interface for the kernel and user programs to access files, regardless of the underlying file system (ext4, XFS, Btrfs, etc.). It acts as an abstraction layer.

Common File System Types#

  • ext4 (Fourth Extended File System): The default and most widely used file system for most Linux distributions. It's a mature, stable, and reliable journaling file system. It's a safe and excellent choice for general use.
  • XFS: A high-performance journaling file system developed by Silicon Graphics. It excels at handling large files and is particularly good for systems like file servers or databases. It's often the default on Red Hat Enterprise Linux and its derivatives.
  • Btrfs (B-Tree File System): A modern file system with advanced features like copy-on-write (CoW), snapshots, built-in RAID support, and data compression. It's seen as a potential long-term successor to ext4 but is still maturing in terms of stability for all use cases.
  • ZFS: Originally developed by Sun Microsystems, ZFS is a powerhouse known for its incredible data integrity features, snapshots, compression, and volume management. It's more common on FreeBSD but is available for Linux via third-party modules.
  • F2FS (Flash-Friendly File System): Optimized for flash-based storage (SSDs, SD cards). It can offer better performance and longer lifespan for these devices compared to traditional file systems.

Journaling: A Key Feature#

Most modern file systems (ext4, XFS, etc.) are journaling file systems. This is a critical feature for data integrity. In the event of an unexpected shutdown (e.g., power loss), a journaling file system records intended changes in a special "journal" before writing them to the main file system. After a crash, the system can quickly replay the journal to complete pending operations or roll them back, ensuring the file system remains consistent without requiring a lengthy fsck (file system check).

The Linux Directory Structure#

Linux organizes files in a hierarchical directory tree, starting from the root (/) directory. Here are some of the most important standard directories:

  • /bin & /usr/bin: Essential user command binaries (e.g., ls, cp).
  • /sbin & /usr/sbin: Essential system administration binaries (e.g., fdisk, ifconfig).
  • /etc: System-wide configuration files for all programs.
  • /home: Personal directories for users.
  • /var: Variable data, such as logs, databases, and mail spools.
  • /tmp: Temporary files that are deleted on reboot.
  • /dev: Device files representing hardware components.
  • /proc & /sys: Virtual file systems providing an interface to kernel and process information.

Conclusion#

The journey from a powered-off machine to a fully functioning Linux desktop is a complex but beautifully orchestrated process. Understanding the roles of BIOS/UEFI, partitioning schemes (MBR/GPT), bootloaders (GRUB), and file systems (ext4, XFS, etc.) empowers you to make better decisions when installing, maintaining, and troubleshooting your system. This knowledge is the bedrock of Linux system administration and provides a deeper appreciation for the stability and flexibility of the Linux operating system.

References#

  1. UEFI Forum - Specifications
  2. GNU GRUB Manual
  3. The Linux Kernel Documentation - Filesystems
  4. Filesystem Hierarchy Standard (FHS)
  5. Arch Wiki - Partitioning
  6. IBM Developer - Anatomy of the Linux file system