Practical Professional Linux — Foundation

Chapter 8 · Skill Level: Foundation

Storage Fundamentals

Understand block devices, filesystems, mounting, fstab, and an introduction to LVM.

Storage management spans block devices, filesystems, mounting, persistent configuration, and logical volume management. These skills underpin capacity planning and are frequently examined.

By the end of this chapter you will be able to

  • Inspect block devices and filesystem usage.
  • Create filesystems and mount them.
  • Configure persistent mounts via /etc/fstab using UUIDs.
  • Explain the LVM model and grow a volume.
  • Diagnose and remediate a full filesystem.

8.1 Inspecting Storage

The four storage commands you’ll use most
lsblk            # disks and partitions as a tree
df -h            # free space per mounted filesystem
du -sh /var/*    # size of each item under /var
blkid            # UUIDs and filesystem types

8.2 Mounting

Extra disks don’t get drive letters — you mount them onto a folder in the single tree. After mounting /dev/sdb1 at /data, that folder *is* the disk.

Mounting and unmounting
sudo mkdir -p /data
sudo mount /dev/sdb1 /data    # attach it
df -h /data                   # confirm
sudo umount /data             # detach it

8.3 Creating Filesystems

A raw partition needs a filesystem before it can hold files. ext4 and XFS are the common choices.

Making a filesystem
lsblk                       # find the new device, e.g. /dev/sdb
sudo mkfs.ext4 /dev/sdb1     # create an ext4 filesystem
# (XFS alternative: sudo mkfs.xfs /dev/sdb1)

8.4 Persistent Mounts with /etc/fstab

A manual mount is forgotten on reboot. /etc/fstab lists filesystems to mount automatically at boot — keyed by UUID, which is stable even if device names change.

Persistent mount via fstab
sudo blkid /dev/sdb1        # get the UUID
# Add a line to /etc/fstab:
# UUID=xxxx-xxxx  /data  ext4  defaults,nofail  0 2
sudo mount -a               # test all fstab entries now

8.5 Logical Volume Management

LVM abstracts physical disks so you can resize and combine storage without repartitioning. The stack is: Physical Volume → Volume Group → Logical Volume.

Growing an LVM volume online
vgs                              # show volume groups and free space
sudo lvextend -L +20G /dev/vg/data   # grow the logical volume
sudo resize2fs /dev/vg/data          # grow the ext4 filesystem to match

8.6 Guided Lab: Storage Survey & Capacity

Estimated time: 25 minutes. Survey storage, find the biggest consumers, and read an fstab — safe, read-only steps you can run on any system.

  • List all block devices: lsblk. Identify your root disk.
  • Show free space per filesystem: df -h. Which is fullest?
  • Find the biggest directories under /var: sudo du -sh /var/* 2>/dev/null | sort -h.
  • Show the UUID and type of your root partition: sudo blkid.
  • Read your current mounts: cat /etc/fstab and compare to mount | column -t.
  • (If you have a spare/test disk only) practise the mkfs + mount + fstab flow from the chapter.

Troubleshooting

Symptom Likely cause and fix
‘No space left on device’ Find the full filesystem with df -h, then the cause with du -sh under it — usually runaway logs in /var/log. Rotate/compress logs rather than deleting open files.
Mounted a disk but it’s empty You may have mounted over an existing folder, hiding its contents, or formatted the wrong partition. Unmount and recheck with lsblk/blkid.
System won’t boot after editing fstab A bad entry dropped it to emergency mode. Boot to rescue, fix/comment the line, run mount -a to verify, then reboot. Use nofail on non-critical mounts.
du and df disagree A deleted-but-open file still consumes space until its process closes. Find it with lsof | grep deleted and restart that process.

Practice & Prove It

Write-the-command drills

  • Show all block devices and partitions as a tree.
  • Show free space on all filesystems in human-readable units.
  • Find the total size of /var/log.
  • Show the UUID of /dev/sdb1.
  • Mount everything listed in /etc/fstab to test it.

Quick quiz

  • What’s the difference between df and du?
  • Why use a UUID in fstab instead of /dev/sdb1?
  • Which command creates an ext4 filesystem?
  • What does the LVM stack order look like?
  • How do you safely test a new fstab entry before rebooting?

Key Takeaways

  • lsblk, df, du, and blkid are your core storage-inspection tools.
  • Extra storage is mounted into the one tree, not given drive letters.
  • mkfs creates a filesystem and erases the target — verify the device first.
  • /etc/fstab makes mounts persistent; key them by UUID and test with mount -a.
  • LVM lets you grow volumes online — the backbone of enterprise storage flexibility.

Next — Chapter 9: networking fundamentals — addresses, ports, DNS, and diagnostics.