# Understanding Linux Storage and Filesystems: From Disks to Files

Have you ever wondered how Linux organizes your files and where they actually live on your storage drive?

Let's say you create a file called `app.py` and save it in your Projects folder. You can open it, edit it, rename it, or delete it whenever you want. But how does Linux organize this file? How does it connect the files and directories you see to the actual storage inside your computer?

There's more going on than you might think!

Linux uses a few different concepts to manage storage and organize data. Once you understand how they work together, things like disks, partitions, filesystems, and mount points will make a lot more sense.

In this blog, we'll break these concepts down step by step, using simple explanations and diagrams to understand what's happening behind the scenes. The goal is to build a clear mental picture of how Linux storage is organized, from the physical disk all the way to the files you use every day.

We'll focus on understanding the core concepts here. In future blogs, we'll get more practical and explore these topics using Linux commands and hands-on examples.

Let's start with the basics!

## #1) What Is Storage?

**Storage is where your data is kept**, even when you shut down your computer.

Your laptop might have an SSD or a hard disk drive (HDD) to store the operating system, applications, documents, projects, and other files.

For example, your laptop might have a 500 GB SSD:

![](https://cdn.hashnode.com/uploads/covers/6acb20b64616d9559a0b65ed/853d8569-e1b2-4450-b152-ca18330c078c.png align="center")

The SSD is the physical storage device inside your computer. It provides the space where your data is kept.

But how does Linux identify and access this device?

### \# How does Linux represent storage devices?

Linux represents storage devices through device files under the `/dev` directory.

For example, an NVMe SSD might appear as:

`/dev/nvme0n1`

A SATA or SCSI-style disk might appear as:

`/dev/sda`

These names are how Linux refers to the corresponding storage devices. The exact names depend on the type of device and your system's configuration.

For now, you don't need to memorize these names. Just remember that `/dev` contains device files through which Linux can access hardware and other devices.

Now that we know what a disk is and how Linux identifies it, let's look at how a single disk can be divided into smaller sections called **partitions**.

## #2) Disk vs Partition

Now that we know what a disk is, let's understand partitions.

Imagine your laptop has a 500 GB SSD. You could use the entire disk as one storage area, but you can also divide it into smaller sections called **partitions**.

For example, here's a 500 GB disk:

![](https://cdn.hashnode.com/uploads/covers/6acb20b64616d9559a0b65ed/3fb1df27-e30c-44ab-a25f-76e85bd9b467.png align="center")

You could divide this disk into three partitions:

![](https://cdn.hashnode.com/uploads/covers/6acb20b64616d9559a0b65ed/87841f61-d2c5-4287-bcd5-259c58a11018.png align="center")

Each partition represents a defined region of the disk.

So, the relationship looks like this:

![](https://cdn.hashnode.com/uploads/covers/6acb20b64616d9559a0b65ed/e25c2f24-6425-45c9-80a3-36a3f9323d7a.png align="center")

Think of a disk as a large storage space and partitions as separate sections within it.

### \# Why do we need partitions?

Partitions let us divide a disk into separate areas for different purposes.

For example, a Linux installation might use partitions like these:

*   **EFI System Partition:** Stores boot-related files used by UEFI firmware to start the operating system.
    
*   **Root partition (**`/`**):** Stores the Linux system, installed software, configuration files, and other data within the root filesystem.
    
*   **Home partition (**`/home`**):** Can be used to store users' personal files and settings separately from the root filesystem.
    
*   **Swap partition:** Can provide disk space for Linux swap.
    

These are common uses, not a list of partitions that every Linux system must have. For example, `/home` can simply be a directory inside the root filesystem instead of having its own partition. Swap can also be configured as a file rather than a partition.

One more thing worth remembering: **a partition is not the same as a filesystem.** A partition defines a region of storage, while a filesystem organizes data within that region. We'll look at filesystems next!

## #3) What Is a Filesystem?

So far, we've learned that a disk can be divided into partitions. But here's a question: **how does Linux organize data inside a partition?**

Imagine you have a partition with 100 GB of storage. It provides space to store data, but we still need a way to organize that data into files and directories.

For example, how would Linux keep track of a file named `project.py`, its contents, who owns it, and which directory it belongs to?

That's where a **filesystem** comes in.

### \# What does a filesystem do?

A filesystem is a method of organizing and managing data on a storage device. It keeps track of things like:

*   **Files and directories:** How files are organized and how they relate to each other.
    
*   **Metadata:** Information about files, such as their size, timestamps, ownership, and permissions.
    
*   **Data locations:** Where the contents of a file are stored within the filesystem.
    

Without a filesystem, Linux wouldn't have the familiar structure of files and directories that we use every day.

Think of a filesystem as the system that organizes storage and makes it possible to work with data as files and directories rather than having to manage raw storage blocks yourself.

### \# Common Linux filesystems

Linux supports several filesystem types, each with its own features. Here are some common examples:

*   **ext4:** A widely used filesystem on Linux desktops and servers.
    
*   **XFS:** A filesystem commonly used on servers, including systems that work with large files and large amounts of data.
    
*   **Btrfs:** A filesystem that supports features such as snapshots, checksums, and compression.
    
*   **ZFS:** A storage and filesystem system known for features such as data integrity checks, snapshots, and storage pooling.
    
*   **tmpfs:** A temporary filesystem that stores data primarily in memory, rather than on a regular disk-based filesystem.
    

### \# How does a filesystem fit into our storage setup?

Let's return to our earlier example. Suppose you have a partition named `/dev/nvme0n1p3`.

You can create an ext4 filesystem on that partition. Once the filesystem is created, it can organize data into files and directories.

For example:

![](https://cdn.hashnode.com/uploads/covers/6acb20b64616d9559a0b65ed/15066b2f-bf5f-408f-97cf-1226569ef297.png align="center")

Creating a filesystem is commonly called **formatting** a partition. Be careful, though, creating a new filesystem can destroy data that was previously stored there.

One important thing to remember is that a filesystem doesn't have to be created on a partition specifically. It can also be created on other suitable storage devices, such as a logical volume. We'll keep our examples focused on partitions for now.

Now that we understand disks, partitions, and filesystems individually, let's put them together and see how they fit into the same storage hierarchy.

## #4) Disk → Partition → Filesystem

Let's put everything together.

Imagine your SSD is divided into partitions, and one of those partitions has an ext4 filesystem.

The relationship looks like this:

![](https://cdn.hashnode.com/uploads/covers/6acb20b64616d9559a0b65ed/24c65bab-c2d6-4f06-ac8f-99447cb066e3.png align="center")

Each layer has a different purpose:

*   **Disk:** Provides physical storage.
    
*   **Partition:** Defines a region of the disk.
    
*   **Filesystem:** Organizes data into files and directories.
    

Remember, a partition is not the same as a filesystem. A partition defines a region of storage, while a filesystem organizes data within it. This is a common setup, though filesystems can also be created on other suitable storage devices.

Now, how do we access these files through the Linux directory structure? Let's understand **mounting**.

## #5) What Is Mounting?

Unlike Windows, which commonly uses drive letters like `C:` and `D:`, Linux makes filesystems accessible through a single directory tree starting at `/` (the root directory).

**Mounting** means attaching a filesystem to a directory in this tree so you can access its files. This directory is called a mount point.

For example, suppose `/dev/nvme0n1p3` contains an ext4 filesystem. You could mount it at `/mnt/data`.

![](https://cdn.hashnode.com/uploads/covers/6acb20b64616d9559a0b65ed/b7b56d39-c739-4a71-b8b0-b1d7ba70c1d7.png align="center")

A filesystem can be mounted at different locations, such as `/mnt/data`, `/home`, or `/opt/storage`. This is possible because Linux uses a single directory tree instead of assigning a separate drive letter to each filesystem.

One thing to remember: mounting a filesystem over a directory hides that directory's existing contents until the filesystem is unmounted. The files aren't deleted.

## #6) Disk vs Partition vs Filesystem vs Mount Point

These four terms are closely related, but each has a different purpose.

| Concept | What it means |
| --- | --- |
| Disk | The physical storage device, such as an SSD or HDD, that provides space to store data. |
| Partition | A defined region of a disk that can be used for a specific purpose, such as storing a filesystem or providing swap space. |
| Filesystem | A structure that organizes and manages data on a storage device, keeping track of files, directories, metadata, and file contents. |
| Mount point | A directory in Linux's directory tree where a filesystem is attached, making its files and directories accessible from that location. |

One thing to remember is that this is a common storage setup, but not the only possibility. A filesystem can also be created directly on a whole disk or another suitable block device without creating a partition first.

## #7) UUID and `/etc/fstab`

When you mount a filesystem manually using the `mount` command, it usually stays mounted until you unmount it or restart your computer. So, how does Linux know which filesystems to mount automatically when the system starts?

That's where `/etc/fstab` comes in.

### \# What is `/etc/fstab`?

`/etc/fstab` is a configuration file that tells Linux which filesystems to mount, where to mount them, and which options to use.

For example, an entry might look like this:

```text
UUID=xxxx-xxxx  /mnt/data  ext4  defaults  0  2
```

Here's what the fields mean:

*   `UUID=xxxx-xxxx`**:** Identifies the filesystem.
    
*   `/mnt/data`**:** The mount point.
    
*   `ext4`**:** The filesystem type.
    
*   `defaults`**:** The mount options to use.
    
*   `0 2`**:** Fields related to the legacy dump utility and filesystem-check order.
    

An entry in `/etc/fstab` allows Linux to mount the filesystem automatically at boot, instead of requiring you to mount it manually each time.

### \# What is a UUID?

A **UUID (Universally Unique Identifier)** is an identifier assigned to a filesystem.

Instead of referring to a device by a name like `/dev/sdb1`, an `/etc/fstab` entry can use its UUID. This is useful because device names can change depending on how storage devices are detected.

In simple terms, **a UUID identifies the filesystem, while** `/etc/fstab` **tells Linux where and how to mount it.**

## #8) The Complete Linux Storage Hierarchy

We've covered quite a few concepts, so let's put everything together and see how they fit into a typical Linux setup.

![](https://cdn.hashnode.com/uploads/covers/6acb20b64616d9559a0b65ed/3ce2e317-2f91-4bd1-accf-175be8e9933f.png align="center")

In this example, an ext4 filesystem is created on the partition `/dev/nvme0n1p2` and mounted at `/`, the root of the Linux directory tree.

Directories such as `/etc`, `/home`, and `/var` are accessible through this tree. They belong to the root filesystem unless separate filesystems are mounted at those locations.

So, when you access `/home/tanmay/Projects/app.py`, you're accessing a file through the Linux directory tree, backed by the filesystem mounted at `/` in this example.

## #9 Exploring storage on your Linux system

Now that we understand the concepts, let's look at a few commands that can help us explore storage on our own Linux systems.

*   `lsblk` - Displays block devices in a tree-like structure, showing disks and their partitions.
    
*   `lsblk -f` - Shows filesystem types, UUIDs, labels, and mount points.
    
*   `findmnt` - Shows which filesystems are currently mounted and where they are mounted.
    
*   `df -hT` - Shows filesystem types, total space, used space, and available space in a human-readable format.
    
*   `du -sh ~/Projects` - Shows the disk space used by your Projects directory. Replace the path with a directory on your own system.
    
*   `cat /etc/fstab` - Displays the configuration for filesystems and other storage resources that Linux can mount or activate, including entries configured for automatic mounting at boot.
    

You don't need to memorize all these commands right away. The goal is to understand what information each one provides and how it connects to the concepts we've covered.

## \# And That's the Big Picture!

Linux storage might seem complicated at first, but its basic concepts become much easier to understand when we break them down step by step.

A disk provides the physical storage, partitions divide it into regions, and filesystems organize data into files and directories. Mount points connect those filesystems to Linux's directory tree, while UUIDs and `/etc/fstab` help identify and configure filesystems for automatic mounting.

Now that we've covered these fundamentals, we have a solid starting point for exploring more advanced Linux storage topics.

In future blogs, we'll explore these concepts further with practical examples and Linux commands, including **Logical Volume Management (LVM)** and how it makes storage management more flexible.

**This is just the beginning.**

**There's a lot more to explore under the hood of Linux!**
