Linucate
~ Linucate_

104.3 Control mounting and unmounting of filesystems

All Levels

Introduction

This lesson is about making filesystems available and taking them away cleanly.

The main question is:

How do you mount a filesystem now, and how do you make it mount automatically later?

What you should be able to do after this lesson:

  • Mount and unmount filesystems manually.
  • Read and write simple /etc/fstab entries.
  • Use labels and UUIDs.
  • Understand user-mountable removable media.
  • Be aware of systemd mount units.

Big Idea: A Filesystem Is Useful Only After It Is Mounted

Linux does not use a filesystem directly from "just being on a partition". It becomes available when attached to a mount point such as:

  • /
  • /home
  • /mnt/data
  • /media/usb

Manual Mounting

Basic command

sudo mount /dev/sdX1 /mnt

Unmount

sudo umount /mnt
sudo umount /dev/sdX1

Important beginner rule:

  • unmount before removing removable media
  • if unmount fails, the filesystem may still be in use

Find Filesystem Identity

blkid

blkid

lsblk

lsblk -f

Sanitized example output:

NAME        FSTYPE LABEL UUID          FSAVAIL FSUSE% MOUNTPOINTS
zram0       swap   zram0 UUID-REDACTED                 [SWAP]
nvme0n1
|-nvme0n1p1 vfat         UUID-REDACTED   807M    21% /boot
|-nvme0n1p2 ext4         UUID-REDACTED  14.4G    65% /
\-nvme0n1p3 ext4         UUID-REDACTED 713.9G    14% /home

What this shows:

  • lsblk -f combines device names, filesystem types, and mountpoints
  • UUIDs are visible and can be used in /etc/fstab

These help you identify:

  • filesystem type
  • label
  • UUID

Why UUIDs and Labels Matter

Device names can change.

Examples:

  • /dev/sdb1 today may become /dev/sdc1 later
  • UUIDs are usually more stable for mounting

That is why /etc/fstab often uses UUIDs.

/etc/fstab

This file defines filesystems to mount at boot or on demand.

Typical line shape:

UUID=xxxx-xxxx  /data  ext4  defaults  0  2

Common mount options you should recognize:

  • defaults
  • ro
  • rw
  • noauto
  • user
  • users

Simple column meaning:

  1. what to mount
  2. where to mount it
  3. filesystem type
  4. mount options
  5. dump field
  6. fsck order

Sanitized example output from mount | grep '^/dev/nvme0n1':

/dev/nvme0n1p2 on / type ext4 (rw,nosuid,nodev,relatime)
/dev/nvme0n1p1 on /boot type vfat (rw,nosuid,nodev,relatime,utf8)
/dev/nvme0n1p3 on /home type ext4 (rw,nosuid,nodev,relatime)

What this shows:

  • the mount command shows where each filesystem is attached
  • it also shows mount options such as rw or relatime

A Sanitized Example

From a real Linux machine, simplified:

Filesystem     Type   Size  Used Avail Use% Mounted on
/dev/nvme0n1p2 ext4    49G   32G   15G  69% /
/dev/nvme0n1p1 vfat  1022M  215M  808M  22% /boot
/dev/nvme0n1p3 ext4   888G  129G  714G  16% /home

This shows which filesystem is mounted where.

Removable Media and User Mounting

Common places:

  • /media/
  • /mnt/

LPIC expects awareness that removable filesystems can be configured as user-mountable.

That is usually done through mount options in /etc/fstab.

Awareness of systemd Mount Units

Modern systems may also use systemd mount units.

You do not need to master them here. The important point is:

mounting can be managed either in classic /etc/fstab style or through systemd unit logic

User-Mountable Removable Media

The objective also mentions user-mountable removable filesystems.

In simple words:

  • not every mount action must be root-only
  • /etc/fstab options such as user or users can allow safer user-triggered mounts
  • this is common for removable media workflows

Practice Step by Step

1) Mount a filesystem manually
  1. Identify it: lsblk -f
  2. Create a mount point: sudo mkdir -p /mnt/data
  3. Mount it: sudo mount /dev/sdX1 /mnt/data
  4. Verify: mount | grep /mnt/data
2) Plan an `/etc/fstab` entry
  1. Get UUID: blkid /dev/sdX1
  2. Decide mount point: /data
  3. Write an entry using UUID instead of /dev/sdX1.

Note About Lesson Numbering

If you are following the LPIC-1 101-500 lesson numbers carefully, you may notice that the next lesson is 104.5, not 104.4.

That is correct.

Reminder: objective 104.4 was removed from the current LPIC-1 Objectives V5.0, so this course correctly jumps from 104.3 to 104.5.

Cheat Sheet

  • mount = attach filesystem to mount point
  • umount = detach filesystem
  • /etc/fstab = persistent mount configuration
  • blkid = show UUID and type
  • lsblk -f = show filesystems and identifiers
  • /media/ = common removable-media mount area
  • UUIDs are usually safer than raw device names
  • systemd mount units exist and are worth recognizing
🎯

Test Your Knowledge

Complete the quiz to assess your understanding of this course's concepts.