Lab activity
Mounting Filesystems and /etc/fstab
Learn how to mount and unmount Linux filesystems, configure mount options, create bind mounts, and manage persistent mount entries using /etc/fstab.
Overview
In this lab, you will learn how to mount and unmount filesystems in Linux using virtual disk images and standard filesystem management commands. You will create an ext4 filesystem, mount it using a loop device, inspect mounted filesystems, and practice read-write, read-only, and security-related mount options. You will also explore the structure of /etc/fstab, back up the configuration before making changes, configure a persistent mount entry for the lab environment, and use mount -a to test it. Finally, you will practice bind mounts and clean up the mount points and configuration changes.
Learning Outcomes
- Create and format a virtual disk image with an ext4 filesystem.
- Inspect mounted filesystems and block devices using
mount,lsblk,df, andfindmnt. - Mount and unmount filesystems using loop devices and custom mount points.
- Apply mount options such as
rw,ro,noexec, andnodev. - Understand the six fields of an
/etc/fstabentry and identify filesystem UUIDs usingblkid. - Back up
/etc/fstab, add a lab mount entry, and test it usingmount -a. - Create and verify bind mounts using
mount --bind.
Key Concepts
- Manual mounting: Attach a filesystem to a directory so its contents can be accessed.
- Loop devices: Use a regular disk image file as a virtual block device for filesystem practice.
- Mount options: Control filesystem access behavior, including read-only access and restrictions on executable files and device files.
- /etc/fstab: Define filesystem mount configuration using the device, mount point, filesystem type, options, dump flag, and filesystem check order.
- Persistent mount testing: Use
mount -ato test configured entries without requiring a reboot. - Bind mounts: Make an existing directory accessible through another location in the filesystem.
- Filesystem inspection: Use
findmnt,mount, anddfto inspect mount status and usage.
Why Needed?
- Mounting and unmounting filesystems are fundamental Linux system administration tasks.
- Correct
/etc/fstabconfiguration helps administrators manage filesystem mounts consistently. - Mount options provide useful controls for restricting filesystem behavior and access.
- Bind mounts help expose directory contents at alternate locations without duplicating files.
- These hands-on exercises build practical filesystem management skills for LFCS preparation and real-world Linux administration.