0 / 15 lessons — 0%
Lesson 06 / 15

Storage & disk management

Disks, partitions, filesystems, and mount points are four different layers that often get flattened into "just storage" — worth pulling apart once so disk errors make sense later.

lsblk # see disks and their partitions, as a tree df -h # disk usage per mounted filesystem, human-readable du -sh /var/log # how much space one directory is actually using
# the basic path: partition -> filesystem -> mount sudo fdisk /dev/sdb # create a partition, interactively sudo mkfs.ext4 /dev/sdb1 # format it with a filesystem sudo mount /dev/sdb1 /mnt/data # attach it into the filesystem tree sudo umount /mnt/data

A plain partition is fixed in size once created — resizing it later means downtime and risk. LVM (Logical Volume Manager) adds a flexible layer on top: combine multiple physical disks into one pool, then carve out logical volumes that can be resized or extended live.

disk /dev/sdb disk /dev/sdc volume group lv-var (20GB) lv-home (60GB) lv-data (100GB)
Multiple physical disks pooled into one volume group, then carved into resizable logical volumes.
sudo pvcreate /dev/sdb /dev/sdc # mark disks as physical volumes sudo vgcreate data-vg /dev/sdb /dev/sdc # pool them into a volume group sudo lvcreate -L 100G -n lv-data data-vg # carve out a logical volume sudo mkfs.ext4 /dev/data-vg/lv-data sudo lvextend -L +20G /dev/data-vg/lv-data # grow it later, live, no downtime

Add an entry to /etc/fstab so a mount survives a reboot instead of vanishing until someone remounts it by hand.

Try it yourselfRun lsblk and df -h side by side on any machine — lsblk shows the raw disk/partition structure, df shows what's actually mounted and how full it is. Matching the two up builds real intuition fast.