Linux Storage and Filesystem Administration: Complete Guide from Beginner to Advanced

Linux Storage and Filesystem Administration: Complete Guide from Beginner to Advanced

Introduction

Linux storage management is one of the most important skills for Linux System Administrators, DevOps Engineers, Cybersecurity Professionals, and Infrastructure Engineers.

Understanding how Linux manages disks, partitions, filesystems, mount points, and storage devices helps administrators manage servers efficiently and troubleshoot storage-related problems.

In this guide, we will explore Linux storage management step by step, starting with the fundamentals and progressing towards practical system administration.

By the end of this tutorial, you will understand how to identify storage devices, inspect partitions, create filesystems, mount disks, configure automatic mounting, and perform basic filesystem administration.


Chapter 1: Understanding Linux Storage

Before working with Linux storage, it is important to understand how a computer stores and organizes data.

Consider a library:

Library ConceptLinux Storage Concept
Library buildingPhysical disk
BookshelfPartition
Library organization systemFilesystem
BooksFiles and directories
Shelf locationMount point

A physical disk cannot normally be used as a regular filesystem until a filesystem has been created and made accessible to the operating system.

The basic storage structure looks like this:

Physical Disk
     |
     v
Partition
     |
     v
Filesystem
     |
     v
Mount Point
     |
     v
Files and Directories

For example:

/dev/sda
    |
    +--- /dev/sda1
    |
    +--- /dev/sda2

Here:

  • /dev/sda represents the physical storage device.

  • /dev/sda1 represents the first partition.

  • /dev/sda2 represents the second partition.

Note: Linux also supports filesystems directly on entire disks, logical volumes, RAID devices, and other block devices without a conventional partition table.


Chapter 2: Understanding Linux Storage Devices

Linux identifies storage devices using device names.

Two commonly encountered device types are NVMe and SATA/SCSI devices.

2.1 What is NVMe?

Example:

/dev/nvme0n1

NVMe stands for Non-Volatile Memory Express.

It is a storage protocol designed for high-speed SSDs, commonly connected through PCIe.

Example partition structure:

nvme0n1
├── nvme0n1p1
├── nvme0n1p2
└── nvme0n1p3

Here:

  • nvme0n1 is the NVMe storage device.

  • nvme0n1p1 is its first partition.

  • nvme0n1p2 is its second partition.

  • nvme0n1p3 is its third partition.

2.2 What is SDA?

Example:

/dev/sda

Linux commonly uses names such as:

/dev/sda
/dev/sdb
/dev/sdc
/dev/sdd

These names typically represent SCSI/SATA-style block devices.

For example:

sda = First detected device
sdb = Second detected device
sdc = Third detected device

The actual naming and ordering can change depending on hardware and device discovery.

2.3 Identify Storage Devices

Use:

lsblk

This command displays available block devices and their partition hierarchy.

For more detailed information:

lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS

This displays:

  • Device name

  • Storage capacity

  • Device type

  • Filesystem type

  • Mount points


Chapter 3: Understanding Disk Partitions

A partition is a logical division of a physical storage device.

For example:

Physical Disk: /dev/sda
|
+--- /dev/sda1
|
+--- /dev/sda2
|
+--- /dev/sda3

Each partition can be used for a different purpose.

Common examples include:

  • Operating system

  • User data

  • Application data

  • Backup storage

  • Swap space

Commands to Identify Partitions

Display all available disks and partitions:

lsblk

Display partition table information:

sudo fdisk -l

Display detailed partition information:

sudo parted -l

These commands help administrators understand the disk layout before performing storage operations.


Chapter 4: What is a Filesystem?

A filesystem is a method used by an operating system to organize, store, retrieve, and manage data on a storage device.

Without a filesystem, a partition is not ready for ordinary file and directory operations.

Think of a filesystem as an organizational structure that manages:

  • Files

  • Directories

  • Permissions

  • Metadata

  • Storage allocation

  • File access

Major Linux Filesystems

4.1 EXT4

EXT4 (Fourth Extended Filesystem) is one of the most widely used Linux filesystems.

Features:

  • Journaling support

  • Large file support

  • Good general-purpose performance

  • Reliable filesystem management

  • Suitable for desktops and servers

Example:

sudo mkfs.ext4 /dev/sdb1

4.2 XFS

XFS is a high-performance journaling filesystem widely used in enterprise Linux environments.

Commonly found in:

  • Red Hat Enterprise Linux

  • Enterprise servers

  • Large storage systems

  • Database environments

Example:

sudo mkfs.xfs /dev/sdb1

4.3 NTFS

NTFS (New Technology File System) is the standard filesystem used by modern Windows installations.

Features:

  • File permissions

  • Journaling

  • Large file support

  • Windows compatibility

Linux can access NTFS partitions using supported drivers.

4.4 FAT32

FAT32 is an older filesystem commonly used in removable storage devices.

Its major limitation is that an individual file cannot exceed 4 GB minus 1 byte.

4.5 exFAT

exFAT is commonly used for USB drives, memory cards, and external storage devices.

Advantages:

  • Supports files larger than 4 GB

  • Compatible with modern Windows and macOS systems

  • Supported by modern Linux distributions


Chapter 5: Identifying the Filesystem Type

Before mounting or formatting a partition, always identify its existing filesystem.

Use:

sudo blkid

To inspect a specific partition:

sudo blkid /dev/sda1

Example output:

/dev/sda1: UUID="acdc32ef-ff1e-425b-aa98-07992ce10d75" TYPE="ntfs"

This tells us:

  • Device: /dev/sda1

  • UUID: acdc32ef-ff1e-425b-aa98-07992ce10d75

  • Filesystem: NTFS

If the filesystem type is NTFS, the partition was formatted using the Windows NTFS filesystem.

Another useful command:

lsblk -f

This displays filesystem information for all detected block devices.


Chapter 6: Understanding Mounting in Linux

Unlike Windows, Linux does not normally assign separate drive letters such as C:, D:, or E:.

Instead, Linux uses a unified directory hierarchy.

Storage devices are attached to directories called mount points.

Common mount point locations include:

/mnt
/media
/data
/home

For example, an additional storage device can be mounted at:

/data

6.1 Create a Mount Point

First, create a directory:

sudo mkdir -p /data

This creates a directory named /data.

At this stage, no additional storage has been mounted.

6.2 Mount a Partition

Example:

sudo mount /dev/sda1 /data

This attaches the filesystem on /dev/sda1 to /data.

You can now access its files through:

cd /data
ls -lah

6.3 Verify the Mount

Use:

df -h

Or:

findmnt /data

To see the mounted filesystem hierarchy:

lsblk -f

Important: Mounting an existing partition does not format it or erase its data. It makes the existing filesystem accessible through the selected directory.


Chapter 7: Understanding the df Command

The df command stands for Disk Free.

It displays filesystem storage utilization.

Command:

df -h

The -h option displays sizes in a human-readable format, such as GB and MB.

Example:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       932G  120G  812G  13% /data

Explanation:

ColumnMeaning
FilesystemStorage device or filesystem
SizeTotal filesystem capacity
UsedUsed storage
AvailAvailable storage
Use%Percentage of storage used
Mounted onMount point

Additional useful commands:

df -hT

Displays filesystem types.

df -i

Displays inode utilization.

du -sh /data

Displays the total disk usage of the /data directory.


Chapter 8: Understanding UUID

UUID stands for Universally Unique Identifier.

A UUID is an identifier associated with a filesystem.

Example:

acdc32ef-ff1e-425b-aa98-07992ce10d75

Think of it as a unique identification number for a filesystem.

Why Use UUID Instead of Device Names?

Consider:

/dev/sda1

After adding or removing storage devices, Linux device names may change.

For example:

Before: /dev/sda1
After:  /dev/sdb1

This can cause problems when automatic mounting depends on device names.

UUID-based mounting provides a more stable way to identify filesystems.

Display UUIDs:

sudo blkid

Or:

lsblk -f

Note: UUIDs are designed to be unique, but they can be duplicated by cloning filesystems or manually copying identifiers. Always verify them.


Chapter 9: Understanding /etc/fstab

The /etc/fstab file controls how filesystems are mounted during system startup.

Its full name is Filesystem Table.

File location:

/etc/fstab

Display its contents:

cat /etc/fstab

Example entry:

UUID=acdc32ef-ff1e-425b-aa98-07992ce10d75 /data ext4 defaults 0 2

Let's understand each field.

FieldMeaning
UUIDFilesystem identifier
/dataMount point
ext4Filesystem type
defaultsDefault mount options
0Dump backup flag
2Filesystem check order

Configure Automatic Mounting

First, obtain the filesystem UUID:

sudo blkid /dev/sda1

Back up the existing configuration:

sudo cp /etc/fstab /etc/fstab.backup

Edit the configuration:

sudo nano /etc/fstab

Add the correct UUID-based entry:

UUID=YOUR-UUID /data ext4 defaults 0 2

Replace YOUR-UUID with the actual filesystem UUID.

Save the file.

Test the Configuration

Before rebooting, execute:

sudo mount -a

If no errors are reported, inspect the mount:

findmnt /data

This helps identify configuration mistakes before restarting the system.

For non-critical external disks, consider options such as nofail to prevent a missing device from unnecessarily interrupting boot.


Chapter 10: Formatting a Partition

Formatting means creating a new filesystem on a storage device or partition.

For example, to create an EXT4 filesystem:

sudo mkfs.ext4 /dev/sda1

The mkfs command means Make Filesystem.

Common filesystem creation commands:

Create EXT4:

sudo mkfs.ext4 /dev/sdb1

Create XFS:

sudo mkfs.xfs /dev/sdb1

Create FAT32:

sudo mkfs.fat -F 32 /dev/sdb1

Create exFAT:

sudo mkfs.exfat /dev/sdb1

Important Formatting Warning

Formatting a partition destroys its existing filesystem structures and makes existing data inaccessible. Recovery may be difficult or impossible.

Always verify the target device before formatting.

Check:

lsblk -f

Confirm:

  • Correct physical disk

  • Correct partition

  • Existing data is backed up

  • Partition is not mounted

  • No active process is using it

Never execute a formatting command on an unknown or production storage device.


Chapter 11: Why Formatting a Mounted Partition Fails

During practical storage administration, you may encounter an error when trying to format a mounted partition.

Example:

sudo mkfs.ext4 /dev/sda1

Possible error:

/dev/sda1 is mounted; will not make a filesystem here!

Why Does This Happen?

Linux prevents formatting a mounted filesystem because it may be actively used by the operating system or applications.

Formatting a mounted partition can cause:

  • Data corruption

  • Filesystem damage

  • Application failures

  • Data loss

Correct Procedure

First, identify the mount point:

findmnt /dev/sda1

Unmount the partition:

sudo umount /dev/sda1

Check whether it is still mounted:

lsblk -f

Only after confirming the correct device is unmounted and safe to erase should you proceed with formatting.


Chapter 12: Understanding Unmounting

Unmounting detaches a filesystem from its mount point.

Command:

sudo umount /data

This disconnects the filesystem from /data.

Verify:

findmnt /data

If the filesystem is no longer mounted, the command will not show a mounted filesystem at that location.

What if the Device is Busy?

Sometimes Linux reports:

target is busy

This means a process may still be accessing the mounted filesystem.

Identify processes using it:

sudo fuser -vm /data

Or:

sudo lsof +f -- /data

Close applications or move active terminal sessions outside the mount point before unmounting.

Avoid forceful or lazy unmounting on production systems unless you understand the consequences.


Chapter 13: Understanding EXT4 Internals

EXT4 is more than a simple method of storing files.

It uses internal structures to manage filesystem data and metadata.

Three important concepts are:

13.1 Inodes

An inode is a filesystem data structure that stores metadata about a file.

It contains information such as:

  • File permissions

  • Owner and group

  • File size

  • Timestamps

  • Data block references

An inode does not normally store the filename itself. Directory entries associate filenames with inode numbers.

Think of an inode as a file's identification record.

Useful command:

ls -i

This displays inode numbers for files.

Check inode utilization:

df -i

13.2 Journaling

EXT4 supports journaling.

A journal helps maintain filesystem consistency after unexpected shutdowns or system crashes.

In a simplified example:

Filesystem Operation
        |
        v
Journal Transaction
        |
        v
Commit Changes
        |
        v
Filesystem Metadata Update

Journaling helps recover filesystem consistency, but it does not guarantee that every recently written file or application transaction will be recovered.

13.3 Superblock

The superblock is a critical filesystem metadata structure.

It contains information such as:

  • Filesystem size

  • Block count

  • Inode count

  • Filesystem state

  • Filesystem configuration

If critical filesystem metadata becomes corrupted, filesystem access and recovery can become difficult.


Chapter 14: Checking and Repairing Filesystems

Linux provides tools to inspect and repair filesystems.

For EXT4:

sudo e2fsck -f /dev/sdb1

Alternatively:

sudo fsck.ext4 /dev/sdb1

Important precautions:

  • Unmount the filesystem before running a repair operation.

  • Never run filesystem repair tools on a mounted read-write filesystem.

  • Back up important data before attempting repairs.

  • Review the reported errors before approving repairs.

For XFS, use:

sudo xfs_repair /dev/sdb1

XFS has its own repair utility and should not be repaired using EXT4-specific tools.


Chapter 15: Linux Storage Administration Command Reference

The following commands are useful for everyday Linux storage administration.

Disk and Partition Discovery

lsblk
lsblk -f
sudo fdisk -l
sudo parted -l

Filesystem Identification

sudo blkid
sudo blkid /dev/sda1

Storage Utilization

df -h
df -hT
df -i
du -sh /data

Mounting and Unmounting

sudo mkdir -p /data
sudo mount /dev/sda1 /data
sudo umount /data
findmnt

Filesystem Creation

sudo mkfs.ext4 /dev/sdb1
sudo mkfs.xfs /dev/sdb1

Filesystem Checking

sudo e2fsck -f /dev/sdb1
sudo xfs_repair /dev/sdb1

UUID and Persistent Mounting

sudo blkid
cat /etc/fstab
sudo mount -a

Chapter 16: Practical Linux Storage Administration Workflow

Here is a simplified example of how a Linux administrator would prepare an additional storage partition.

Assume that /dev/sdb1 is a new partition intended for application data.

Step 1: Identify the storage device

lsblk

Step 2: Inspect the filesystem

sudo blkid /dev/sdb1

Step 3: Create a mount point

sudo mkdir -p /data

Step 4: Create an EXT4 filesystem

Only if the partition is new or its existing contents have been backed up and approved for erasure:

sudo mkfs.ext4 /dev/sdb1

Step 5: Identify the new UUID

sudo blkid /dev/sdb1

Step 6: Mount the partition

sudo mount /dev/sdb1 /data

Step 7: Verify the storage

df -hT

Step 8: Configure persistent mounting

Back up and edit /etc/fstab, then add the correct UUID-based entry:

UUID=YOUR-UUID /data ext4 defaults 0 2

Step 9: Test the configuration

sudo mount -a

Step 10: Verify the final configuration

lsblk -f
df -hT
findmnt /data

This workflow demonstrates the basic process of preparing and managing Linux storage.


Chapter 17: Advanced Linux Storage Topics to Learn Next

Once you understand disks, partitions, filesystems, and mounting, you can move towards advanced Linux storage technologies.

17.1 LVM (Logical Volume Manager)

LVM provides flexible storage management by allowing administrators to combine physical storage devices into logical storage pools.

Important concepts:

  • Physical Volume (PV)

  • Volume Group (VG)

  • Logical Volume (LV)

17.2 RAID

RAID combines multiple physical disks to provide different levels of redundancy and performance.

Common RAID levels:

  • RAID 0

  • RAID 1

  • RAID 5

  • RAID 6

  • RAID 10

17.3 NFS

Network File System allows Linux systems to share directories and access remote storage over a network.

17.4 SMB

Server Message Block is commonly used for network file sharing, especially between Windows and Linux systems.

17.5 iSCSI

iSCSI allows block-level storage access over IP networks.

17.6 Docker Volumes

Docker volumes provide persistent storage for containerized applications.

17.7 Kubernetes Persistent Volumes

Kubernetes uses Persistent Volumes (PV) and Persistent Volume Claims (PVC) to manage persistent application storage.

17.8 Cloud Storage

Cloud environments provide different storage technologies, including:

  • Azure Managed Disks

  • AWS EBS

  • Google Persistent Disk

  • Cloud object storage

Understanding Linux storage fundamentals makes it easier to work with these technologies.


Conclusion

Linux storage management is a fundamental skill for anyone working in Linux administration, DevOps, Cybersecurity, SOC operations, or cloud infrastructure.

In this practical learning exercise, we explored the complete storage management process, including:

  1. Identifying physical disks and storage devices.

  2. Understanding disk partitions.

  3. Identifying existing filesystem types.

  4. Creating mount points.

  5. Mounting and unmounting partitions.

  6. Understanding disk utilization using df.

  7. Identifying filesystems using UUIDs.

  8. Configuring persistent mounting through /etc/fstab.

  9. Creating EXT4 filesystems.

  10. Understanding inodes, journaling, and superblocks.

  11. Checking and repairing filesystems.

  12. Learning about advanced storage technologies.

These concepts form the foundation of real-world Linux system administration.

The next step is to gain practical experience with LVM, RAID, NFS, and enterprise storage management.

Keep learning, keep experimenting, and build your Linux administration skills one practical task at a time.


Enjoyed this guide?

Get new cybersecurity, ethical hacking and Linux tutorials straight to your inbox. No spam.

Previous Post
No Comment
Add Comment
comment url