Introduction
Manual mounts are temporary (like a camping tent).
To make them permanent (like a house), edit /etc/fstab.
fstab (Filesystem Table) is the "Startup To-Do List".
In this lab, you will add a persistent mount instruction.
This file matters because manual mounts disappear after reboot. Persistent mounts require the system to know, at boot time, what should be mounted and where.
Read /etc/fstab
View the current list:
cat /etc/fstab
Output:
## <file system> <mount point> <type> <options> <dump> <pass>
UUID=... / ext4 errors=remount-ro 0 1
Columns:
- Device: What to mount (UUID or path).
- Mount Point: Where to mount it.
- Type: Filesystem (ext4, xfs).
- Options: Rules (defaults, ro).
- Dump/Pass: Backup/Check flags (0 0).
Even if administrators do not memorize every fstab field immediately, they must respect the file. A small typo here can prevent a filesystem from mounting correctly at startup.
Edit fstab
Add an entry for our disk image.
Backup first!
That is a good systems habit in general: before editing an important configuration file, create a restorable copy so recovery is easy if the change goes wrong.
sudo cp /etc/fstab /etc/fstab.bak
Edit with nano:
sudo nano /etc/fstab
Add this line at the bottom:
/home/labex/project/disk.img /home/labex/project/mountpoint ext4 defaults,loop 0 0
Breakdown:
- Device: Path to image.
- Point: Path to folder.
- Type:
ext4. - Options:
defaults,loop(loop is needed for files).
Save: Ctrl+O, Enter, Ctrl+X.
Verify (mount -a)
Test without rebooting!
mount -a reads fstab and mounts everything.
sudo mount -a
If no output = Success.
If error = Typo (Fix it!).
This is why mount -a is such a valuable safety check. It lets you test the configuration immediately instead of discovering mistakes only after a reboot.
Verify it's mounted:
df -h | grep mountpoint
Output:
/dev/loopX ... /home/labex/project/mountpoint
Summary
In this lab, you moved from "Camping" (temporary mounts) to "Building" (persistent mounts).
/etc/fstab: The system's startup checklist for storage.- Backups: Critical checks before editing important system files.
mount -a: The safe way to test your checklist without rebooting.
Every professional Linux administrator relies on these steps to ensure servers come back online correctly after a restart.



