← Back to list

Mastering Linux Storage: Partitions, File Systems, and LVM Explained

Learn Linux storage from the ground up. Understand partitions, file systems (EXT, NFS), external storage (DAS, NAS, SAN), and LVM with…

codingsprints in Stackademic · 2025-04-26 16:31 · 0 claps · 4.6 min read paywalled
#linux-storage #disk-partitioning #das-nas-san #lvm-in-linux #filesystem
Open on Medium ↗
Wiki topics: RAG · RAG & Retrieval 🔓 · Open Source

Mastering Linux Storage: Partitions, File Systems, and LVM Explained

Learn Linux storage from the ground up. Understand partitions, file systems (EXT, NFS), external storage (DAS, NAS, SAN), and LVM with examples.

Demystify Linux storage architecture with hands-on examples and practical tips for managing disks, partitions, file systems, and LVM.

Introduction

Storage management is a critical skill for any Linux system administrator. Whether you’re spinning up VMs or managing physical servers, understanding how Linux handles block devices, partitions, file systems, and logical volume management (LVM) will help you configure reliable, efficient, and scalable systems.

This guide breaks it down with real commands and examples. Let’s get started.

Understanding Block Devices

In Linux, a block device is a special file **/dev** that represents a device you can read/write in blocks, like an SSD or a spinning HDD.

Examples of block devices:

  • **/dev/sda** – Represents an entire disk.
  • **/dev/sda1, `/dev/sda2`** – Represent individual partitions.

List all Block devices

  • Block devices are special files that refer to or represent a device (which could be anything from a hard drive to a USB drive). So naturally, there are command-line tools that help you with your block device-related work.
  • Major Number is used to identify the type of block device, value 8 represents a SCSI device that starts with SD.
  • Minor Number is used to distinguish individual, physical or logical devices.
[~]$ lsblk 
[~]$ ls -l /dev/ | grep "^b"

You’ll see block devices starting with a b. For example:

brw-rw---- 1 root disk 8, 0 Apr 24 10:00 /dev/sda
brw-rw---- 1 root disk 8, 1 Apr 24 10:00 /dev/sda1
  • Major number (e.g., 8): Identifies the driver type (e.g., SCSI).
  • Minor number: Distinguishes different devices or partitions.

Disk Partitioning in Linux

Partitions let you segment a disk for multiple purposes — boot files, root filesystem, data, etc.

Common partition types:

  • Primary: Bootable and can host an OS.
  • Extended: Acts like a container for logical partitions.
  • Logical: Created within extended partitions.

Example from lsblk:

  • **/dev/sda1 → mounted at `/boot/efi`**
  • **/dev/sda2 → mounted at `/media/MM/data`**
  • **/dev/sda3 → mounted at `/`**

Partition info is stored in a partition table.

View Partition Table:

fdisk -l

It shows details like partition type, start and end sectors, and size.

Partitioning Schemes: MBR vs GPT

MBR (Master Boot Record)

  • Max 4 primary partitions.
  • 2 TB disk size limit.
  • Use extended + logical partitions to go beyond 4.

GPT (GUID Partition Table)

  • Supports up to 128 partitions (in RHEL).
  • No 2 TB limit.
  • Default for modern systems.

Use GPT unless the OS needs MBR.

Creating Partitions: Hands-On Lab

Let’s create a 20 GB partition on **/dev/sdb**.

Step-by-step with gdisk:

sudo gdisk /dev/sdb

Then:

  • Press **?** for help
  • Press **n** to create a new partition
  • Accept default values or set the partition number, size: **+20G**
  • Accept the default type: **8300 **(Linux filesystem)
  • Press **w** to write changes

🎉 Now you have **/dev/sdb1**!

Verify:

lsblk

or

sudo fdisk -l
[~]$ gdisk /dev/sdb
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present
Found valid GPT with protective MBR; using GPT.

Command (? for help): ?
b back up GPT data to a file
c change a partition's name
d delete a partition
i show detailed information on a partition
l list known partition types
n add a new partition
o create a new empty GUID partition table (GPT)
p print the partition table
q quit without saving changes
r recovery and transformation options (experts only)
s sort partitions
t change a partition's type code
v verify disk
w write table to disk and exit
x extra functionality (experts only)
? print this menu

Command (? for help): n
Partition number (1-128, default 1): 1
First sector (34-41943006, default = 2048) or {+-}size{KMGTP}: 2048
Information: Moved requested sector from 34 to 2048 in
order to align on 2048-sector boundaries.
Use 'l' on the experts' menu to adjust alignment
Last sector (2048-41943006, default = 41943006) or {+-}size{KMGTP}: 41943006
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/vdb.
The operation has completed successfully.

Filesystems in Linux

A file system determines how files are stored and organized. After partitioning, a file system must be created.

Popular Linux File Systems:

  • EXT2/3/4 — Extended file systems
  • XFS — High-performance journaling
  • NFS — Network file system

Create File System:

mkfs.ext4 /dev/sdb1

Then mount it:

sudo mount /dev/sdb1 /mnt/mydata

Check mounted FS:

df -h

External Storage: DAS, NAS, SAN

Linux systems can connect to various storage architectures beyond internal disks.

DAS — Direct Attached Storage

  • Directly connected (USB, SATA)
  • No sharing across a network
  • Simple and fast

NAS — Network Attached Storage

  • Uses network protocols like NFS or SMB
  • Ideal for file sharing
  • Appears like a remote folder

SAN — Storage Area Network

  • High-speed block-level access
  • Uses iSCSI or Fibre Channel
  • Appears as a local disk

LVM: Logical Volume Management

LVM allows flexible disk management by abstracting physical storage.

LVM Key Concepts:

  • PV (Physical Volume): A physical disk or partition.
  • VG (Volume Group): A pool of PVs.
  • LV (Logical Volume): Virtual partitions from VGs.

Create LVM Step-by-Step

Let’s say **/dev/sdb1** is available.

sudo pvcreate /dev/sdb1
sudo vgcreate myvg /dev/sdb1
sudo lvcreate -L 10G -n mylv myvg

Then format and mount:

sudo mkfs.ext4 /dev/myvg/mylv
sudo mount /dev/myvg/mylv /mnt/lvmdata

Verify with:

lsblk

Troubleshooting: Disk Not Showing Full Size?

If your system doesn’t show the full disk size:

  • Check with **lsblk and `fdisk -l`**
  • The disk might be unpartitioned
  • The partition table may be MBR-limited
  • Use **gdisk **to convert to GPT if needed

Summary

We covered a full journey through Linux storage:

  • Block devices and partition types
  • ️MBR vs GPT partitioning schemes
  • How to create partitions with **gdisk**
  • Filesystems like EXT4 and NFS
  • External storage: DAS, NAS, SAN
  • LVM creation and mounting

You now have the power to manage Linux disks like a pro. 💪

Claps and comments, and following the CodingSprints channel are appreciated! 💬👏

Share your thoughts and let’s learn together. Found it helpful? Give it a clap, or 5!

🔗 Connect with us: 📘 Facebook | 🐦 Twitter | 💻 GitHub | 🔗 LinkedIn

Thank you for being a part of the community

Before you go:


메타데이터
post_id
4dcdec10b13b
slug
mastering-linux-storage-partitions-file-systems-and-lvm-explained-4dcdec10b13b
url
https://blog.stackademic.com/mastering-linux-storage-partitions-file-systems-and-lvm-explained-4dcdec10b13b
canonical_url
https://blog.stackademic.com/mastering-linux-storage-partitions-file-systems-and-lvm-explained-4dcdec10b13b
author_url
https://medium.com/@codingsprints
status
ok
fetched_at
2026-07-30 10:53:43