Storage Stack: Disk, Partition, LVM, Filesystem, Mount¶
Mental model¶
Five layers from hardware to usable directory. Each layer transforms raw blocks into something the layer above can use. LVM is optional but common in servers.
What it looks like¶
"Format the disk and mount it" — skipping three layers in between.
What it really is¶
Disk: a block device. The kernel exposes it as /dev/sda,
/dev/nvme0n1, etc. Raw storage with no structure. Reads and writes
happen in fixed-size blocks (typically 512B or 4K).
Partition: subdivides a disk into regions. Partition table (GPT or
MBR) maps offset ranges to partition devices (/dev/sda1, /dev/sda2).
Each partition is itself a block device.
LVM (Logical Volume Manager): optional abstraction layer. Physical Volumes (PV) are partitions or whole disks. Volume Groups (VG) pool PVs together. Logical Volumes (LV) carve out usable block devices from VGs. Key benefit: resize, snapshot, span multiple disks.
Filesystem: organizes blocks into files and directories. ext4, xfs,
btrfs each have different on-disk structures but all present the same
POSIX interface. Created with mkfs. The filesystem lives inside a
partition or LV.
Mount: attaches a filesystem to a directory in the VFS namespace.
mount /dev/vg0/data /mnt/data makes the filesystem accessible at
/mnt/data. /etc/fstab makes mounts persistent across reboots.
Why it seems confusing¶
People say "format the disk" when they mean "create a filesystem on a partition on the disk." The layers between disk and mounted directory are invisible in normal use, so they collapse mentally.
What actually matters¶
- Each layer is independent. You can put a filesystem directly on a disk (no partitions, no LVM). You can use LVM without partitions.
lsblkshows the full stack in tree form.- Extending storage with LVM:
lvextendthe LV, thenresize2fsorxfs_growfsthe filesystem. Two separate operations. - Partitions cannot be resized easily (must unmount, delete, recreate). LVM exists specifically to solve this.
/dev/mapper/entries are device-mapper devices (LVM, LUKS, dm-crypt all use this layer).
flowchart TD
DISK["/dev/sda\n(Disk)"] --> PART["/dev/sda1\n(Partition)"]
PART --> PV["PV\n(Physical Volume)"]
PV --> VG["VG\n(Volume Group)"]
VG --> LV["/dev/vg0/data\n(Logical Volume)"]
LV --> FS["ext4 / xfs\n(Filesystem)"]
FS --> MNT["/mnt/data\n(Mount Point)"]
style DISK fill:#888,color:#fff
style LV fill:#36f,color:#fff
style FS fill:#5a5,color:#fff
style MNT fill:#f80,color:#fff
Common mistakes¶
- Creating a filesystem on
/dev/sdainstead of/dev/sda1(works but wipes the partition table). - Extending an LV but forgetting to resize the filesystem inside it.
- Thinking
mountis permanent (it's not — use/etc/fstab). - Confusing partition resize (destructive, requires unmount) with LV resize (online, non-destructive with LVM).
- Not knowing that xfs can only grow, never shrink.
Small examples¶
Viewing the full stack:
Creating the full stack:
# 1. Partition
gdisk /dev/sdb # create GPT partition
# 2. LVM
pvcreate /dev/sdb1 # physical volume
vgcreate vg1 /dev/sdb1 # volume group
lvcreate -L 50G -n app vg1 # logical volume
# 3. Filesystem
mkfs.ext4 /dev/vg1/app
# 4. Mount
mount /dev/vg1/app /opt/app
echo '/dev/vg1/app /opt/app ext4 defaults 0 2' >> /etc/fstab
Extending an LV + filesystem:
One-line summary¶
Disk → partition → LVM → filesystem → mount: five layers from raw blocks to usable directory.