In the previous chapter, we learned about the Linux directory structure along with the Filesystem Hierarchy Standard (FHS) that governs it. We now know that the entire system appears as a single directory tree rooted at /. The next question that arises is: where is this data actually stored physically, and how does Linux manage it? This chapter answers that question by discussing disk partitioning, common filesystem types in Linux, the concept of swap, as well as how to mount and unmount filesystems. We will also learn how to view disk space usage using the df and du commands, as well as the Disk Usage Analyzer graphical application.
13.1 Disk Partitioning Concepts
A storage device, such as a hard disk or SSD, is physically a single whole unit. However, a single disk is rarely used as a single storage block. To facilitate management, we usually divide a disk into several parts called partitions.
A partition is a logical division of a disk. Each partition appears to the operating system as a separate storage device, even though it physically resides on the same disk. Through partitioning, we can separate the operating system from personal data, install two operating systems side by side (dual boot), or allocate dedicated space for specific purposes such as swap.
Each partition is then formatted with a filesystem. Partitioning and filesystems are two different but interrelated things: a partition is a physical space division, while a filesystem is the rules governing how files are stored and organized within that partition. A partition cannot be used to store files until it is formatted with a specific filesystem.
13.2 Partition Types: MBR and GPT
Dividing a disk into partitions requires a scheme that records the partition information itself. There are two main schemes used today: MBR and GPT.
13.2.1 MBR (Master Boot Record)
MBR is a legacy partition scheme introduced during the IBM PC era in the 1980s. Partition information in the MBR scheme is stored in the first sector of the disk (sector 0), along with the boot loader code. MBR has several limitations:
- Only supports a maximum of 4 primary partitions. To create more than 4 partitions, one of the primary partitions must be made into an extended partition, inside which multiple logical partitions can be contained.
- The maximum partition size is 2 TB. Disks larger than 2 TB cannot be fully utilized by MBR.
Due to these limitations, MBR is increasingly abandoned and is generally only found on legacy systems or specialized boot media.
13.2.2 GPT (GUID Partition Table)
GPT is a modern partition scheme that is the current standard, used alongside UEFI as a replacement for BIOS. GPT stores partition information in multiple copies across the disk, making it more resilient to corruption compared to MBR, which stores only a single copy. Advantages of GPT include:
- Supports up to 128 partitions by default on Linux systems.
- Supports very large disk sizes, far exceeding the 2 TB limit.
- Stores a backup of the partition table at the end of the disk, so it can be recovered if the main table is corrupted.
Ubuntu 26.04 and Fedora Workstation 44 use GPT by default for installations on modern UEFI-based computers. When we install an operating system, the installer will usually select GPT automatically.
13.3 Common Filesystem Types in Linux
After a partition is created, it needs to be formatted with a filesystem. Linux supports many filesystem types. Here are some of the most common ones we encounter.
| Filesystem | Description |
|---|---|
| ext4 | Default filesystem in Ubuntu |
| Btrfs | Default filesystem in Fedora Workstation; supports snapshots and compression |
| XFS | Default filesystem in Fedora Server; excels at large files and high throughput |
| FAT32 and NTFS | Compatibility with Windows |
| tmpfs | Filesystem residing in RAM |
13.3.1 ext4: Default Filesystem in Ubuntu
ext4 (short for fourth extended filesystem) is the default filesystem on Ubuntu 26.04 LTS. ext4 is an evolution of ext3, which has proven to be stable and reliable over many years.
ext4 supports very large file and partition sizes, and offers good performance for a wide range of workloads. Due to its maturity and reliability, ext4 is a safe choice for the majority of desktop users. If we install Ubuntu with automatic settings, the system will use ext4.
13.3.2 Btrfs: Default Filesystem in Fedora Workstation
Btrfs (pronounced "Butter FS" or "B-tree FS") is a modern filesystem offering advanced features not found in ext4 or XFS, including:
- Snapshot: the ability to record the state of the filesystem at a point in time, similar to a restore point.
- Compression: the ability to transparently compress data to save disk space.
- Checksum: data integrity verification to detect corruption.
- Subvolume: a logical partition inside the filesystem that can be managed separately.
Fedora has made Btrfs the default filesystem for its desktop variants since Fedora 33 in 2020, and this policy remains in effect up to Fedora Workstation 44. When we install Fedora Workstation with an automatic partitioning scheme, the Anaconda installer creates a single Btrfs volume and splits it into several subvolumes, typically one subvolume for / (root) and another for /home (the /boot partition remains separate and is usually formatted as ext4 for boot loader compatibility reasons). This subvolume approach allows / and /home to share the same free space without needing fixed-size partitions for each, while opening the way for snapshot features useful as recovery points before performing major system updates.
Although it is now standard in Fedora Workstation, Btrfs is relatively newer compared to ext4 and XFS, so some experienced users still choose to switch to ext4 manually during installation due to prioritizing maturity and simplicity. openSUSE and several other distributions also make Btrfs their default.
13.3.3 XFS: High-Performance Filesystem, Default in Fedora Server
XFS is a filesystem developed by Silicon Graphics (SGI) designed to handle large files and parallel operations, making it superior at handling large data volumes and high throughput.
It should be clarified that XFS is not the default filesystem on the Fedora Workstation edition; rather, it is the default on the Fedora Server edition. Prior to Fedora 33, XFS was indeed the default on the desktop edition, but starting with Fedora 33, the Workstation edition switched to Btrfs as explained in the previous section. XFS remains available as an option on Anaconda custom partitioning screens if we wish to use it in Fedora Workstation, and it remains a mainstay for server scenarios storing high volumes of large files. One important limitation sysadmins should know: XFS does not support shrinking at all, whether online or offline, unlike ext4 which can be shrunk via resize2fs or Btrfs which supports online resize. For everyday desktop usage, performance differences between ext4, Btrfs, and XFS are generally subtle; all three are reliable and fast.
13.3.4 FAT32 and NTFS: Compatibility with Windows
FAT32 and NTFS are filesystems originating from the Windows world. Linux does not use them as system filesystems, but understanding both is very useful when interacting with Windows devices.
- FAT32 is a simple filesystem that is very widely supported, including by Windows, macOS, Linux, cameras, and other electronic devices. Its downside is that FAT32 only supports a maximum file size of 4 GB. Due to its broad support, FAT32 is widely used for USB flash drives.
- NTFS is the primary filesystem for modern Windows, supporting large files and various security features. Linux can read and write NTFS thanks to the
ntfs3driver available in modern kernels.
When we plug in a flash drive or external hard drive formatted as FAT32 or NTFS, both Ubuntu and Fedora will be able to read it without extra configuration.
13.3.5 tmpfs: Filesystem in RAM
tmpfs is a filesystem whose contents are stored in RAM memory, not on disk. Because it resides in RAM, access to tmpfs is extremely fast, but all its content is lost when the computer is turned off or rebooted.
Linux systems use tmpfs for several directories such as /tmp on many distributions, as well as /dev/shm which is used for shared memory between processes. tmpfs is well suited for temporary data that does not need to persist for long and demands fast access.
13.4 Swap: What It Is and Why It Is Needed
Swap is space used by the system as an extension of RAM memory. When physical RAM becomes full, the system can move rarely used data from RAM to swap to free up space. This process is called swapping.
Swap can take the form of a dedicated partition (swap partition), a file (swap file), or even a compressed block device within RAM itself called zram. Ubuntu 26.04 LTS by default uses a swap file created inside the root filesystem. Fedora Workstation 44 takes a different approach: since Fedora 33, Fedora no longer creates traditional swap partitions by default, enabling swap-on-zram instead via the zram-generator service. Zram compresses data prior to swapping it and stores it in a dedicated RAM area, making the process much faster than disk-based swap, though trade-offs exist (see hibernation note below).
Why is swap needed? There are several main reasons:
- Handling RAM shortages. If applications demand memory exceeding RAM capacity, swap prevents the system from running out of memory.
- Supporting hibernation features. When we enable hibernation, the system saves the RAM content to swap before the computer powers off completely. Note: because zram itself resides in RAM and is wiped during complete power-off, Fedora Workstation (which relies solely on swap-on-zram by default) requires configuring an additional swap file or swap partition on disk if we want to enable hibernation.
- Providing buffer space. Even if our computer has ample RAM, swap remains useful as a safety net.
It must be understood that disk-based swap is significantly slower than RAM. If the system frequently transfers data between RAM and swap, performance will drop noticeably, a condition sometimes called thrashing. Swap is a safety net, not a replacement for RAM.
13.5 Mount and Unmount
In the previous chapter, we were introduced to the concept of a mount point. In this section, we will delve deeper into the concept of mounting and its opposite, unmounting.
13.5.1 Mounting Concepts
Mounting is the process of attaching a filesystem located on a partition or device to a directory (mount point) within the Linux directory tree. Once a filesystem is mounted, its contents can be accessed via that mount point.
When we plug in a USB flash drive, the system automatically mounts that drive to a directory such as /media/username/drive-name. We can also mount manually using the mount command. For example, to mount the /dev/sdb1 partition to the /mnt directory:
sudo mount /dev/sdb1 /mntAfter the above command succeeds, confirm the filesystem is properly attached by running df -h /mnt or mount | grep /dev/sdb1. If the partition appears in the output along with its mount point, the mounting process was successful.
Unmounting is the reverse process, detaching a filesystem from the directory tree. Unmounting is crucial before unplugging a storage device to ensure all data writing is finished. The command is umount (without the letter "n"):
sudo umount /mntIf a filesystem is currently in use, for example, if an open file exists within it, the system will reject the unmount command with an error message such as target is busy to prevent data loss. In production, sysadmins usually check which process is still using the mount point with fuser -vm /mnt or lsof +f -- /mnt, then terminate that process before retrying the unmount.
13.5.2 /etc/fstab: Automatic Mount at Boot
If we mount manually, we must repeat the process every time the computer boots up. For partitions that need to be permanently attached, Linux provides a configuration file called /etc/fstab (short for filesystem table).
/etc/fstab contains a list of filesystems that will be mounted automatically during system boot. Each line in this file consists of several columns: device or UUID, mount point, filesystem type, mount options, as well as dump and fsck settings.
As an example, an /etc/fstab entry to automatically mount an ext4 partition might look like this:
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /home ext4 defaults 0 2Use a UUID (Universally Unique Identifier) instead of device names like /dev/sda1, because UUIDs remain consistent even if device ordering changes when adding or removing disks. When the installer installs Ubuntu or Fedora, it automatically creates and populates the /etc/fstab file according to the chosen partitions.
13.6 Viewing Disk Usage
Knowing how much disk space is used and remaining is an essential foundational skill. Linux provides several tools for this purpose.
13.6.1 df and du
df (short for disk free) displays disk space usage for all currently mounted filesystems. Using the -h (human-readable) option, sizes are shown in easy-to-read units like MB, GB, or TB:
df -hThis command outputs a list of filesystems alongside total capacity, used space, available space, and their respective mount points.
du (short for disk usage) displays the size of a specific directory or file. The du command is useful when identifying which directories consume substantial space. For example, to view the size of our home directory:
du -sh ~The -s (summarize) option displays total size without listing every subdirectory, while the -h option renders sizes easy to read.
13.6.2 Disk Usage Analyzer (GUI)
If we prefer a graphical interface, GNOME provides the Disk Usage Analyzer application, which can be installed and used to visualize disk space usage. This application scans directories and presents ring charts or treemap diagrams showing the proportion of space occupied by each directory.
Through Disk Usage Analyzer, we can quickly locate large files or folders consuming space without typing terminal commands. This app is especially helpful when disk space runs low and we need to determine what to clean up.
In this chapter, we learned about disk partitioning concepts, differences between MBR and GPT partition schemes, and various common filesystem types in Linux such as ext4, Btrfs, XFS, FAT32, NTFS, and tmpfs, alongside which distributions use them by default. We also explored swap functionality, including the differing approaches between swap files in Ubuntu and swap-on-zram in Fedora, mounting and unmounting workflows, the role of /etc/fstab in automatic mounting, and methods for monitoring disk utilization using df, du, and Disk Usage Analyzer.
In the next chapter, we will enter a vital new topic: the command line interface. We will start exploring the terminal and shell, forming the baseline for understanding commands discussed in upcoming chapters.

