Linux Intermediate 09 — Block Devices, Filesystems, and Mounts

Linux course index · Linux Intermediate category · Lesson 9 of 9

AI disclosure — AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.

Learning goal

Distinguish a block device from a filesystem and a mount point, and inspect each layer without changing it.

Concepts and setup

A disk or virtual block device supplies storage. A partition is a region of a device. A filesystem organizes data, and a mount point attaches the filesystem to the directory tree. A mount can hide what was already in that directory. df reports capacity of mounted filesystems. du walks files and adds up their usage, so deleted-but-open files, mounts, permissions, and allocation details can drive differences.

The site’s cloud volume example uses named devices. Do not reuse an old example’s device name. Device paths can change across machines and boots. For persistent mounts, inspect UUIDs and plan an /etc/fstab backup. Do not format or repair anything in this read-only lab.

Inspect the filesystem containing your home directory

lsblk -o NAME,TYPE,SIZE,FSTYPE,MOUNTPOINTS
findmnt -T "$HOME" -o SOURCE,TARGET,FSTYPE
df -h "$HOME"
lsblk -f

Possible output

NAME   TYPE  SIZE FSTYPE MOUNTPOINTS
vda    disk   30G
└─vda1 part   30G ext4   /
SOURCE    TARGET FSTYPE
/dev/vda1 /      ext4
Filesystem      Size Used Avail Use% Mounted on
/dev/vda1        30G 5.0G   23G  18% /
...

Actual layouts can be layered with LVM, encryption, or a separate /home. Use lsblk and findmnt together to interpret the layout. In a VM, match the disk identity and size to the hypervisor’s inventory.

Compare directory usage to filesystem capacity

lab=$(mktemp -d)
printf 'Linux storage lab\n' > "$lab/example.txt"
du -sh "$lab"
df -h "$lab"

Possible output

8.0K    /tmp/tmp.ABC
Filesystem      Size Used Avail Use% Mounted on
/dev/vda1        30G 5.0G   23G  18% /

The temporary directory might live on tmpfs or a different device. du -sh and df -h measure different things.

Questions only

Quick-check questions

  1. Does creating a partition also mount a filesystem?
  2. Is the source printed by findmnt always a physical disk?

Assessment questions

  1. Which command associates an arbitrary path with its active mount?
  2. Which two observations would help diagnose a filled /var?
  3. Why verify fstab before leaving an administration session?

Questions and answers

Quick-check answers

  1. Does creating a partition also mount a filesystem?
    Answer — No. A filesystem must exist and be attached to the directory tree separately.
  2. Is the source printed by findmnt always a physical disk?
    Answer — No. It may be a logical volume, network filesystem, tmpfs, or another type.

Assessment answer key

  1. Which command associates an arbitrary path with its active mount?
    Answer — findmnt -T /path/to/check.
  2. Which two observations would help diagnose a filled /var?
    Answer — Use df -h /var to identify the filled filesystem, then locate large visible directories with an appropriately scoped du or inspect for deleted-but-open files.
  3. Why verify fstab before leaving an administration session?
    Answer — A mistaken persistent mount can fail at boot or delay startup even if the current session is unaffected.

Source articles on this site

Continue the course

Previous lesson 08 — SSH Keys, Host Identity, and File Transfer. This is the last lesson in this level. See the course index for the next level.

Linux course index · Linux Intermediate category · Lesson 9 of 9

Leave a Reply